Asp & Sql
I have a main.asp file calling list.asp with:
... list.asp?the_file&the_race ...
In list.asp I have two querystring requests as follows:
and an SQL statement as below:
Sql = "SELECT Rno, Tabno, Name, Starts, Wins, Second, Third, Bp, Jock, Weight FROM " & dbf_file
The problem is that I don't want all the records in the data table, but want to apply a WHERE condition to get only those records where race_str equals a variable number passed from main.asp. The data table itself is also variable and is passed from main.asp.
If I knew that the number (race_str) was 5 and that the data table to be accessed (dbf_file) was Test.dbf then I could use:
Sql = "SELECT Rno, Tabno, Name, Starts, Wins, Second, Third,
Bp, Jock, Weight FROM Test.dbf WHERE Rno = 5
However I don't, so I've tried:
Sql = "SELECT Rno, Tabno, Name, Starts, Wins, Second, Third, Bp, Jock, Weight FROM " & dbf_file " WHERE Rno = " & race_str
and I get the following error message:
"Microsoft VBScript compilation error - Expected end of statement"
How do I properly concatenate the explicit SQL statement with the variable values I obtain from the querystring requests?
Can someone help?