View Full Version : Variable is being passed wrong

07-22-2004, 04:13 PM
I am opening an asp and passing a record ID with the request. When it gets to the SQL statement the variable has extra quotes around it causing it not to be in the recordset.

http//blah blah blah/debug.asp?EvtID="NKA82947222004"

strEvtID = request.querystring("EvtID")

response.write "In program<br>"
if strEvtID <> "" then
'See if it is a draft by looking for this in the drafts table.
strSQL = "SELECT * FROM Drafts WHERE EventID='" & strEvtID & "'"
vSQL = "Select * from qryApprovers where UserID='" & strMyUID & "';"

Response.write "strSQL = " & strSQL & "<br>"
Response.write "vSQL = " & vSQL & "<br>"

I put the vSQL in to check another line from another page I had written. It comes out right. The strSQL doesn't!

In the browser this is what I get;

In program
strSQL = SELECT * FROM Drafts WHERE EventID='"NKA8294Jul222004"'
vSQL = Select * from qryApprovers where UserID='NKA8294';

When I removed the quotes from the query string I got another error, fixed that error and the call ran right without the quotes. Just overloked stuff. Thanks.
Thanks for the help,