Faulty SQL?

Results 1 to 2 of 2

Thread: Faulty SQL?

  1. #1
    Join Date
    Dec 1969

    Default Faulty SQL?

    I have an ASP that has the following code in it:<BR><BR>&#039;Extract the first letter of the query string.<BR>strTerm = Left(Request.Querystring("find"), 1)<BR><BR>&#039;Build the SQL statement.<BR>strSQL = "SELECT txtTerm, memDefinition, blnCrossRef FROM tblTerms WHERE txtTerm LIKE &#039;" & strTerm & "*&#039;"<BR><BR>&#039;Create the db connection.<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>objConn .Open("DSN=terms")<BR><BR>&#039;Run the SQL.<BR>Set varReturnArray = objConn.Execute( strSQL )<BR><BR>I have another page with a nearly identical block of code that searches for a specific term rather than just all terms beginning with a specific letter. The page that searches for a single term works. The code on this page however returns an empty record set. The db at the other end of the ODBC connection is MS Access 2000.<BR><BR>Can anyone tell me what I might be doing wrong.

  2. #2
    Join Date
    Dec 1969

    Default RE: Faulty SQL?

    Replace "*" with "%" in the sql statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts