How do You Recall a Variable from a Form When Inside SQL

Results 1 to 2 of 2

Thread: How do You Recall a Variable from a Form When Inside SQL

  1. #1
    Join Date
    Dec 1969
    Posts
    206

    Default How do You Recall a Variable from a Form When Inside SQL

    I have been working to have a variable sent by a URL to be put into a SQL statement. I can make any on the right hand side of a statement work, but when defining thing like table and columns, I cannot. Actually, I still haven&#039t been able to declare two variables across a page. Please help me if you can. Below is the code that I am using to draw the variable from the URL and put them into the SQL statement<BR><BR>Dim SearchText<BR>SearchText=CStr(Request("group"))<BR >Dim SearchField<BR>SearchField=CStr(Request("field"))< BR>strSQL= "SELECT * FROM products WHERE &#039&searchfield&&#039=&#039"&SearchText&"&#039"< BR><BR>The URL that comes accross is something like lskdjf.com/page.htm?group=Variable&field=Variable2

  2. #2
    KPW Guest

    Default RE: How do You Recall a Variable from a Form When Inside SQL

    Try this:<BR><BR>strSQL = "SELECT * FROM products WHERE " & SearchField & " = &#039" & SearchText & "&#039"<BR><BR>It looks like you may have been using single quotes where you should have had double quotes (before and after the SearchField variable).<BR><BR>Hope this helps!

Posting Permissions

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