syntax for LIKE stmt

Results 1 to 3 of 3

Thread: syntax for LIKE stmt

  1. #1
    Join Date
    Dec 1969
    Posts
    632

    Default syntax for LIKE stmt

    I want the user to enter text in a text box and have the value passed to an ASP page. I then want this value entered in the text box to be compared against all values in a column in an Access database. If any part of the values in the database are similar to the text value, I want to display it.<BR><BR>I tried doing the following:<BR>&#060;%<BR>Dim Choice<BR>choice=request.form("nametext")<BR>..... <BR>.....<BR>rsName.Open "Select NameID,linkpage,RName,RAddress,RCity,RState,RZip from NameInfo where NameID Like &#039%choice%&#039"<BR><BR>Of course it isn&#039t working...what is the correct syntax??? ANy help is appreciated.

  2. #2
    sm549 Guest

    Default RE: syntax for LIKE stmt

    Assuming % is the wildcard character for your database, you have the right idea, just use string concatenation to produce the sql statement. Response.Write() the statement and check it out in your query tool to see if it will work.<BR><BR>Dim sSQL<BR>choice=Trim(request.form("nametext"))<BR>< BR>sSQL = "Select NameID,linkpage,RName,RAddress,RCity,RState,RZip from NameInfo where NameID Like &#039%" & choice & "%&#039"<BR><BR>Response.Write "&ltBR&gt" & sSQL & "&ltBR&gt"<BR><BR>rsName.Open sSQL, dbConn &#039Are you connected?<BR><BR>HIH<BR>

  3. #3
    sm549 Guest

    Default RE: syntax for LIKE stmt

    Use * as the wildcard character for an access database.

Posting Permissions

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