Including Variables as in SQL

Results 1 to 2 of 2

Thread: Including Variables as in SQL

  1. #1
    Join Date
    Dec 1969

    Default Including Variables as in SQL

    I have had a problem including any variable that I passed from the previous page into a SQL statement. I can get them easily to be like this:<BR>strSQL= "SELECT * FROM distributor WHERE zip=&#039"&SearchText&"&#039"<BR>but to make them be a field such as<BR>strSQL= "SELECT * FROM distributor WHERE &#039"&SearchText&"&#039=y".<BR><BR>I know it is most likely a simple problem of placing punctuation, but I have tried almost everything.<BR>Please help!<BR><BR>Dawn

  2. #2
    Jon Guest

    Default RE: Including Variables as in SQL

    Essentially you only need to put single tick marks around text type data that you want to insert into the database. Your problem in the sample you provided is the single tick marks around SearchText. SearchText is a field specifier not a parameter.<BR><BR>strSQL= "SELECT * FROM distributor WHERE &#039"&SearchText&"&#039=y".<BR><BR>Good Luck.

Posting Permissions

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