Syntax Question

From: Umpty (Umpty_at_discussions.microsoft.com)
Date: 12/28/04

  • Next message: Nitin: "Unexpected error creating debug information file .pdb"
    Date: Tue, 28 Dec 2004 11:53:01 -0800
    
    

    Trying to use Microsoft Indexing Service.

    Here is my code using SQL Query Analyzer, which works perfectly.

    SELECT * FROM
    OPENQUERY(FileSystem,
            'SELECT RANK, FileName, Characterization
            FROM SCOPE(''"/ASPNetDemo/Resumes"'')
            WHERE FREETEXT(''Baione'') > 0
            ORDER BY RANK DESC' )

    but... when I put this code in the script in my ASPX page, apparently the
    syntax does not work. The following is all of my code.

    Sub btnSearch_Click(ByVal s As Object, ByVal e As EventArgs)
            Dim conMyData As SqlClient.SqlConnection
            Dim strSearch As String
            Dim cmdSearch As SqlClient.SqlCommand
            Dim dtrSearch As SqlClient.SqlDataReader
            
            conMyData = New
    SqlClient.SqlConnection("Server=Localhost;UID=sa;PWD=test;Database=Pubs")
            strSearch = "SELECT * FROM " & _
            "OPENQUERY(FileSystem, " & _
            "'SELECT RANK, FileName, VPath, Characterization " & _
            "FROM SCOPE(''" & "/ASPNetDemo/Resumes" & "'') " & _
            "WHERE FREETEXT(''" & txtSearchPhrase.Text & _
            "'') > 0 " & _
            "ORDER BY RANK DESC' )"

            cmdSearch = New SqlClient.SqlCommand(strSearch, conMyData)
            conMyData.Open()
            Try
                dtrSearch = cmdSearch.ExecuteReader()
                lblResults.Text = "<ul>"
                While dtrSearch.Read
                    lblResults.Text &= "<li> (" & dtrSearch("RANK") / 10 & "%) "
                    lblResults.Text &= "<a href=""" &
    dtrSearch("VPath").ToString()
                    lblResults.Text &= """>"
                    lblResults.Text &= dtrSearch("FileName") & "</a><br>"
                    lblResults.Text &= dtrSearch("Characterization")
                    lblResults.Text &= "<p>"
                End While
            Catch ex As Exception
                lblResults.Text = "Please rephrase your query"
            End Try
            conMyData.Close()
        End Sub

    *If I do not pass any parameters, then this code works, its just when I
    attempt to tell it to distinctly look into the specified folder that it does
    not work.

    Any help in pointing out the correct syntax using the SCOPE function would
    be greatly appreciated.

    Thanks


  • Next message: Nitin: "Unexpected error creating debug information file .pdb"

    Relevant Pages

    • Syntax Problem in Code using SCOPE() function
      ... Trying to use Microsoft Indexing Service. ... Here is my code using SQL Query Analyzer, ... Sub btnSearch_Click ... Any help in pointing out the correct syntax using the SCOPE function would ...
      (microsoft.public.dotnet.general)
    • Re: repplace char in $1
      ... i tried to replace space with other chars in the first field: ... i have found the correct syntax: ... gsub replace all space by ' ' and sub replace the delimiter at end ...
      (comp.lang.awk)
    • Re: repplace char in $1
      ... i tried to replace space with other chars in the first field: ... i have found the correct syntax: ... gsub replace all space by ' ' and sub replace the delimiter at end ...
      (comp.lang.awk)
    • Re: ClearContents does not work...
      ... It is the correct syntax and the correct command. ... only a single new workbook. ... Sub AAA ...
      (microsoft.public.excel.programming)