SQL statment

Results 1 to 3 of 3

Thread: SQL statment

  1. #1
    Daniel Guest

    Default SQL statment

    I am trying to create a SQL statment with a variale from the QueryString...<BR><BR>Say I have ?id=22 in the QueryString.<BR><BR>Now I want to create:<BR>strSQL= "SELECT * FROM table1 WHERE ID=22"<BR><BR>However I can&#039t get the propper syntax or something. Here is what I have been trying:<BR><BR>Dim strSQL<BR>Dim strID<BR>Set strID = Request.QueryString("id")<BR>strSQL= "SELECT * FROM table1 WHERE ID=" & strID & "<BR><BR>Any ideas?

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL statment

    if ID is a number:<BR><BR>Dim strSQL<BR>Dim intID<BR>Set intID = Request.QueryString("id")<BR>strSQL= "SELECT * FROM table1 WHERE ID=" & intID

  3. #3
    David Forster Guest

    Default RE: SQL statment

    OK, this is a guess, but here goes...<BR><BR>Dim strSQL<BR>Dim strID<BR>Set strID = Request.Querystring("id")<BR>strSQL = "SELECT * FROM table1 WHERE ID=&#039" & strID &"&#039"<BR><BR>Let me know if this works!

Posting Permissions

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