Variables within SQL Queries

Results 1 to 2 of 2

Thread: Variables within SQL Queries

  1. #1
    Dan James Guest

    Default Variables within SQL Queries

    I&#039d like to use a variable (defined in VBScript) to search for a particular record in a database. E.g.<BR><BR>&#060;% Anumber=3 <BR><BR>SQLquery="SELECT client.clientInfo FROM client WHERE...<BR>...(((client.clientID)=Anumber));"<BR> %&#062;<BR>I&#039ve tried doing this but it won&#039t the syntax wrong <BR>or isn&#039t it possible to do this?

  2. #2
    Dan H Guest

    Default RE: Variables within SQL Queries

    You need to use concatenation (&) characters when using variables or anything that is not part of SQL queries.<BR>Ex.<BR>("SELECT field1, field2, field3 " & _ <BR>"FROM table " & _<BR>"WHERE field1 LIKE &#039" & StringVariable & "%&#039 " & _<BR>"AND field1 = " & IntVariable & " ") <BR><BR>

Posting Permissions

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