ASP SQL Statement

J

Justin Meyer

Can anyone see what is wrong with this?

'declare variables
Dim ID2
Dim connection, sSQL, sConnString
ID2 = Trim(Request.QueryString("ID"))
'SQL statement
sSQL="DELETE * FROM Results WHERE ID='" & ID2 & "'"
 
K

Kevin Spencer

Hi Justin,

What data type is ID in the database? If it's numeric, you need to lose the
single quotes around the value in your SQL Statement:

sSQL="DELETE * FROM Results WHERE ID=" & ID2

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
J

Justin Meyer

'declare variables
Dim ID2
Dim connection, sSQL, sConnString
ID2 = Trim(Request.QueryString("ID"))
'SQL statement
sSQL="DELETE * FROM Results WHERE ID=('" & ID2 & "')"


This give the following Error Message?
 
J

Justin Meyer

Its an Auto Number in a Access Database

Kevin Spencer said:
Hi Justin,

What data type is ID in the database? If it's numeric, you need to lose the
single quotes around the value in your SQL Statement:

sSQL="DELETE * FROM Results WHERE ID=" & ID2

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
J

Justin Meyer

Good Idea, but I tried that also and get the following message.
Does this give any additional Info?
 
K

Kevin Spencer

Apparently, there is no "ID" value in the QueryString. Do you see one in
your browser?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
J

Justin Meyer

Thanks you so much, the link was were the problem was.
If only I would have seeked you out sooner. You could have saved me a great
deal of frustration.

Thanks again.
Justin
 
K

Kevin Spencer

I'll be here, Justin!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top