lblText.Text =" Found" &安培; hits.Length()& " 匹配查询< br>的记录 ''" Gender:< b>" &安培; txtGender.Value& "< / B><峰; br> " &安培; _ ''" Fetal muscle:< b>" &安培; txtFetus.Value& "< / b>< br> " &安培; _ ''"同意书:< b>" &安培; txtConsent.Value& "< / b>< br> " &安培; _ ''"免疫印迹肌营养不良蛋白结果:< b>" & txtIMBDystResult.Value& "< / B><峰; br> " &安培; _ ''" Immunoblot dystrophin diagnosis:< b>" & txtIMBDystDiag.Value& "< / B><峰; br> " &安培; _ ''"免疫荧光肌营养不良蛋白结果:< b>" & txtIMFDystResult.Value& "< / B><峰; br> " &安培; _ ''"免疫荧光肌营养不良症诊断:< b>" & txtIMFDystDiag.Value& "< / B><峰; br> " &安培; _ ''"评论< b>" &安培; txtDescription.Text& "< / b>< br>" Dim i As Integer = 0 For i = 0 to hits.Length - 1 Dim doc As Document = hits.Doc(i) lblResults.Text& ="< li> PROCEDURE ID:" & doc.Get(" PROCEDURE_ID")。TrimEnd& _ "主题ID: &安培; doc.Get(" SUBJECT_ID")。TrimEnd& _ " < a href =''searchsubject.aspx?subject_ID =" & doc.Get(" SUBJECT_ID")。Trim& _ "''target =''_ blank''>选择此记录< / a>< / li>" ''"< a href =''target.aspx?target = view& subject_ID =" & doc.Get(" SUBJECT_ID")。Trim& _ ''"& proc =" &安培; doc.Get(PROCEDURE_ID)。修剪& _ ''"& biopsy =" &安培; doc.Get(BIOPSY_ID)。修剪& _ ''"& age =" &安培; doc.Get(AGE_YEAR)。修剪& _ ''"& physician =" &安培; doc.Get(PHYSICIAN_ID)。修剪& _ ''"& fetus =" &安培; doc.Get(IS_FETUS)。修剪& _ 下一页 lblResults.Text& ="< / ul>" 结束尝试 End Sub 结束班Hi,I''m new to vb.net programming, and I keep getting this error: Name''GetQuery'' is not declared. I can''t figure out why?? It seems like I havethe right references/namespaces. This is my code below. Also, can someoneexplain to me what the ContentHandlerImpl.vb file actually does? It''s inthis project that I''m working with...but I''m not sure what the file actuallydoes. Thanks!!Imports System.XmlImports Lucene.Net.DocumentsImports Lucene.Net.AnalysisImports Lucene.Net.IndexImports Lucene.Net.SearchImports Lucene.Net.QueryParsersImports Lucene.Net.UtilImports SystemImports System.IOPublic Class SampleSearch2Inherits System.Web.UI.Page#Region " Web Form Designer Generated Code "''This call is required by the Web Form Designer.<System.Diagnostics.DebuggerStepThrough()> Private SubInitializeComponent()End SubProtected WithEvents txtGender As System.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtConsent As System.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMBDystResult AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMFDystResult AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMBDystDiag AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMFDystDiag AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMFMerosinResult AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents SearchButton As System.Web.UI.WebControls.ButtonProtected WithEvents lblText As System.Web.UI.WebControls.LabelProtected WithEvents lblResults As System.Web.UI.WebControls.LabelProtected WithEvents txtFetus As System.Web.UI.HtmlControls.HtmlSelectProtected WithEvents SearchButton1 As System.Web.UI.WebControls.ButtonProtected WithEvents txtDescription As System.Web.UI.WebControls.TextBoxProtected WithEvents txtIMBDysferlin AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMFAlpha As System.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtIMFMerosin AsSystem.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtAgeFrom As System.Web.UI.WebControls.TextBoxProtected WithEvents txtAgeTo As System.Web.UI.WebControls.TextBoxProtected WithEvents txtDateTo As System.Web.UI.WebControls.TextBoxProtected WithEvents txtDateFrom As System.Web.UI.WebControls.TextBoxProtected WithEvents txtAsymp As System.Web.UI.HtmlControls.HtmlSelectProtected WithEvents txtFamilyHistory AsSystem.Web.UI.HtmlControls.HtmlSelect''NOTE: The following placeholder declaration is required by the Web FormDesigner.''Do not delete or move it.Private designerPlaceholderDeclaration As System.ObjectPrivate Sub Page_Init(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Init''CODEGEN: This method call is required by the Web Form Designer''Do not modify it using the code editor.InitializeComponent()End Sub#End RegionPrivate strXmlFilePath As String = Server.MapPath("/xmlsearch/xmlfiles/")Private strIndexFilePath As String =Server.MapPath("/xmlsearch/xmlindex/")Private searcher As IndexSearcher = New IndexSearcher(strIndexFilePath)Private analyzer As Standard.StandardAnalyzer = NewStandard.StandardAnalyzerPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load''Put user code to initialize the page hereEnd SubPrivate Sub SearchButton1_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles SearchButton1.ClickDim strGender As StringDim strConsent As StringDim strFetus As StringDim strAgeFrom As StringDim strAgeTo As StringDim strAge As StringDim strDateFrom As StringDim strDateTo As StringDim strDate As StringDim strAsymp As StringDim strFamilyHistory As String''IMF for Immuno-flourescenceDim strIMFDystResult As StringDim strIMFDystDiag As StringDim strIMFMerosin As StringDim strIMFAlpha As String''IMB for ImmunoblotDim strIMBDystResult As StringDim strIMBDystDiag As StringDim strIMBDysferlin As StringDim strDesc As StringDim searcher As IndexSearcher = New IndexSearcher(strIndexFilePath)Dim analyzer As Standard.StandardAnalyzer = NewStandard.StandardAnalyzerDim hits As Hits''start with every click, we need to clean the resultlblText.Text = ""lblResults.Text = ""strAge = ""strDate = ""strGender = txtGender.Value.ToUpperstrConsent = txtConsent.Value.ToUpperstrFetus = txtFetus.Value.ToUpperstrAgeFrom = txtAgeFrom.TextstrAgeTo = txtAgeTo.TextstrDateFrom = txtDateFrom.TextstrDateTo = txtDateTo.TextstrAsymp = txtAsymp.Value.ToUpperstrFamilyHistory = txtFamilyHistory.Value.ToUpperstrIMFDystResult = txtIMFDystResult.Value.ToUpperstrIMFDystDiag = txtIMFDystDiag.Value.ToUpperstrIMFMerosin = txtIMFMerosin.Value.ToUpperstrIMFAlpha = txtIMFAlpha.Value.ToUpperstrIMBDystResult = txtIMBDystResult.Value.ToUpperstrIMBDystDiag = txtIMBDystDiag.Value.ToUpperstrIMBDysferlin = txtIMBDysferlin.Value.ToUpperstrAgeFrom.Trim()If strAgeFrom.Length = 1 ThenstrAgeFrom = "00" & strAgeFromElseIf strAgeFrom.Length = 2 ThenstrAgeFrom = "0" & strAgeFromElseIf strAgeFrom.Length = 0 ThenstrAgeFrom = "000" ''minimun ageEnd IfstrAgeTo.Trim()If strAgeTo.Length = 1 ThenstrAgeTo = "00" & strAgeToElseIf strAgeTo.Length = 2 ThenstrAgeTo = "0" & strAgeToElseIf strAgeTo.Length = 0 ThenstrAgeTo = "120" ''maximun ageEnd If''we will use wildcard for strDescstrDesc = txtDescription.TextDim strWords() As String = strDesc.Split(" ")''Construct the query based upon the inputIf strGender.Length > 0 ThenstrGender = "+GENDER:" & strGenderEnd IfIf strConsent.Length > 0 ThenstrConsent = "+IS_CONSENT_FORM:" & strConsentEnd IfIf strFetus.Length > 0 ThenstrFetus = "+IS_FETUS:" & strFetusEnd If'' the logic here is both length of strAgeFrom and strAgeTo aregreather than 0'' but if strAgeFrom = "000" and strAgeTo = "120" that means neitherone is entered by usersIf strAgeFrom.Equals("000") And strAgeTo.Equals("120") ThenElsestrAge = "+AGE_YEAR:[" + strAgeFrom + " TO " + strAgeTo + "]" &strAgeEnd If''must contain both DateFrom and DateTo to search. Use AND instead ofORIf strDateFrom.Length > 0 And strDateTo.Length > 0 ThenstrDate = "+BIOPSY_DATE:[" + strDateFrom + " TO " + strDateTo +"]" & strDateEnd IfIf strFamilyHistory.Length > 0 ThenstrFamilyHistory = "+FAMILY_HISTORY:" & strFamilyHistoryEnd IfIf strIMBDystResult.Length > 0 ThenstrIMBDystResult = "+DYST_RESULT:" & strIMBDystResultEnd IfIf strIMBDystDiag.Length > 0 ThenstrIMBDystDiag = "+DYST_DIAGNOSIS:" & strIMBDystDiagEnd IfIf strIMBDysferlin.Length > 0 ThenstrIMBDysferlin = "+DYSFERLINE_RESULT:" & strIMBDysferlinEnd IfIf strIMFDystResult.Length > 0 ThenstrIMFDystResult = "+DYST_RESULT_FLO:" & strIMFDystResultEnd IfIf strIMFDystDiag.Length > 0 ThenstrIMFDystDiag = "+DYST_DIAGNOSIS_FLO:" & strIMFDystDiagEnd IfIf strIMFMerosin.Length > 0 ThenstrIMFMerosin = "+MEROSIN_RESULT_FLO:" & strIMFMerosinEnd IfIf strIMFAlpha.Length > 0 ThenstrIMFAlpha = "+ALPHA_SAC_RESULT_FLO:" & strIMFAlphaEnd IfIf strDesc.Length > 0 Then''the description field is wild card searc''clean up the strDesc firststrDesc = ""Dim i As IntegerFor i = 0 To strWords.Length - 1Dim strWord As String = strWords(i)strWord.Trim()If strWord.Length > 0 Then''append the "*"strWord = strWord + "*"End IfstrDesc += "+" + strWord + " "NextstrDesc = "+OTHER:(" + strDesc + ")"Else''clean up the strDescstrDesc = ""End If''concatenate the queryDim strQuery As String = ""If strGender.Length > 0 ThenstrQuery += strGender + " "End IfIf strFetus.Length > 0 ThenstrQuery += strFetus + " "End IfIf strAge.Length > 0 ThenstrQuery += strAge + " "End IfIf strDate.Length > 0 ThenstrQuery += strDate + " "End IfIf strConsent.Length > 0 ThenstrQuery += strConsent + " "End IfIf strFamilyHistory.Length > 0 ThenstrQuery += strFamilyHistory + " "End IfIf strIMBDystResult.Length > 0 ThenstrQuery += strIMBDystResult + " "End IfIf strIMBDystDiag.Length > 0 ThenstrQuery += strIMBDystDiag + " "End IfIf strIMBDysferlin.Length > 0 ThenstrQuery += strIMBDysferlin + " "End IfIf strIMFDystResult.Length > 0 ThenstrQuery += strIMFDystResult + " "End IfIf strIMFDystDiag.Length > 0 ThenstrQuery += strIMFDystDiag + " "End IfIf strIMFMerosin.Length > 0 ThenstrQuery += strIMFMerosin + " "End IfIf strIMFAlpha.Length > 0 ThenstrQuery += strIMFAlpha + " "End IfIf strDesc.Length > 0 ThenstrQuery += strDescEnd IfDim query1 As Query = GetQuery(strQuery, analyzer)''SearchTryhits = searcher.Search(query1)Catch myerr As SystemExceptionlblText.Text = "There are no documents that match your search."Exit SubFinallylblText.Text = "Found " & hits.Length() & " record(s) thatmatched query<br> "'' "Gender: <b>" & txtGender.Value & "</b><br> " & _'' "Fetal muscle: <b>" & txtFetus.Value &"</b><br> " & _'' "Consent form: <b>" & txtConsent.Value &"</b><br> " & _'' "Immunoblot dystrophin result: <b>" &txtIMBDystResult.Value & "</b><br> " & _'' "Immunoblot dystrophin diagnosis: <b>" &txtIMBDystDiag.Value & "</b><br> " & _'' "Immuno-flourescence dystrophin result:<b>" &txtIMFDystResult.Value & "</b><br> " & _'' "Immuno-flourescence dystrophin diagnosis:<b>" &txtIMFDystDiag.Value & "</b><br> " & _'' "Comments<b>" & txtDescription.Text & "</b><br>"Dim i As Integer = 0For i = 0 To hits.Length - 1Dim doc As Document = hits.Doc(i)lblResults.Text &= "<li>PROCEDURE ID: " &doc.Get("PROCEDURE_ID").TrimEnd & _" SUBJECT ID: " & doc.Get("SUBJECT_ID").TrimEnd & _" <a href=''searchsubject.aspx?subject_ID=" &doc.Get("SUBJECT_ID").Trim & _"'' target=''_blank''>Choose this record</a></li>"'' "<a href=''target.aspx?target=view&subject_ID=" &doc.Get("SUBJECT_ID").Trim & _''"&proc=" & doc.Get("PROCEDURE_ID").Trim & _''"&biopsy=" & doc.Get("BIOPSY_ID").Trim & _''"&age=" & doc.Get("AGE_YEAR").Trim & _''"&physician=" & doc.Get("PHYSICIAN_ID").Trim & _''"&fetus=" & doc.Get("IS_FETUS").Trim & _NextlblResults.Text &= "</ul>"End TryEnd SubEnd Class推荐答案 ST< ST @ discussions.microsoft.com>写道:ST <ST@discussions.microsoft.com> wrote:我是vb.net编程的新手,我不断收到此错误:名称''GetQuery''未声明。我不明白为什么?好像我有正确的引用/命名空间。这是我的代码。另外,有人可以向我解释ContentHandlerImpl.vb文件实际上做了什么吗?我正在和这个项目合作......但是我不确定文件实际上是什么。谢谢!! I''m new to vb.net programming, and I keep getting this error: Name ''GetQuery'' is not declared. I can''t figure out why?? It seems like I have the right references/namespaces. This is my code below. Also, can someone explain to me what the ContentHandlerImpl.vb file actually does? It''s in this project that I''m working with...but I''m not sure what the file actually does. Thanks!! 嗯,你打算打电话给GetQuery什么?你已经展示了尝试给b 打电话,但没有声明它。 - Jon Skeet - < sk *** @ pobox.com> http:// www。 pobox.com/~skeet 如果回复小组,请不要给我发邮件Well, what GetQuery are you trying to call? You''ve shown the attempt tocall it, but no declaration for it.--Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeetIf replying to the group, please do not mail me too你的意思究竟是什么意思?对不起,这是别人做过的代码,而且他们告诉我只需将它添加到我们现有的项目中。 " Jon Skeet [ C#MVP]"写道:What do you mean exactly? Sorry, this is code that somebody else did, andthey told me to just add it into an existing project we have."Jon Skeet [C# MVP]" wrote: ST< ST@discussions.microsoft.com>写道: ST <ST@discussions.microsoft.com> wrote:我是vb.net编程的新手,我不断收到此错误:名称''GetQuery''未声明。我不明白为什么?好像我有正确的引用/命名空间。这是我的代码。另外,有人可以向我解释ContentHandlerImpl.vb文件实际上做了什么吗?我正在和这个项目合作......但是我不确定文件实际上是什么。谢谢! I''m new to vb.net programming, and I keep getting this error: Name ''GetQuery'' is not declared. I can''t figure out why?? It seems like I have the right references/namespaces. This is my code below. Also, can someone explain to me what the ContentHandlerImpl.vb file actually does? It''s in this project that I''m working with...but I''m not sure what the file actually does. Thanks!! 那么,你想要调用什么GetQuery?你已经展示了试图给它打电话,但没有声明它。 - Jon Skeet - < sk *** @ pobox.com> http://www.pobox.com/~skeet Well, what GetQuery are you trying to call? You''ve shown the attempt to call it, but no declaration for it. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too ST< ST@discussions.microsoft.com>写道:ST <ST@discussions.microsoft.com> wrote:你的意思是什么?对不起,这是其他人做的代码,并且他们告诉我只是将它添加到我们现有的项目中。 What do you mean exactly? Sorry, this is code that somebody else did, and they told me to just add it into an existing project we have. 然后你需要问它们也适用于GetQuery方法 - 然后 从头开始学习VB.NET,而不是从现有代码开始学习VB.NET。我知道它很苛刻,但是从第一原则学习更有可能获得一个良好的语言基础(和框架)。 - Jon Skeet - < sk *** @ pobox.com> http://www.pobox.com/~skeet 如果回复小组,请执行不要给我发邮件Then you need to ask them for the GetQuery method as well - and thenstart learning VB.NET from scratch, rather than from existing code. Iknow it''s harsh, but learning from first principles is much more likelyto get you a good firm foundation in the language (and the framework).--Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeetIf replying to the group, please do not mail me too 这篇关于vb.net“未声明名称”题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-27 19:20
查看更多