Dynamically creating a SQL Statement

Results 1 to 3 of 3

Thread: Dynamically creating a SQL Statement

  1. #1
    Join Date
    Dec 1969
    Posts
    177

    Default Dynamically creating a SQL Statement

    Here is my SQL statement that has some sort of syntax error. I am connecting to an access &#039;97 database. strTrackID requests data from a multiple select box (successfully, I&#039;ve verified this step). Then that value has the following replace function.<BR><BR>strTrackID = Request("TrackID")<BR>strTrackID = Replace( strTrackID, ", ", "&#039;,&#039;" )<BR><BR>strSQL = "Select date, TrackID, Handle, GrossRevenue, Tax, Purses from StateData where WHERE TrackID IN (&#039;" & strTrackID & "&#039;)"<BR><BR>Error Message<BR><BR>Error Type:<BR>Microsoft JET Database Engine (0x80040E14)<BR>Syntax error (missing operator) in query expression &#039;WHERE TrackID IN (&#039;ACR&#039;)&#039;.<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    10,852

    Default RE: Dynamically creating a SQL Statement

    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=58

  3. #3
    Join Date
    Dec 1969
    Posts
    896

    Default RE: Dynamically creating a SQL Statement

    is StateDate.TrackID integer, or varchar?

Posting Permissions

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