I have been working thru the asp tutorials on this site and have a problem I don't understand.
I am writing a asp page to delete a recordset from my database. When it executes the line
rsCoupon.Delete
it gives me the follwing error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '(ID=Pa_RaM000 AND Company Name=Pa_RaM001 AND Coupon Description IS NULL AND Hyperlink To JPEG=Pa_RaM002 AND Start Date=Pa_RaM003 AND Expiration Date=Pa_RaM004 )'.
I can confirm with Response.Write that I have loaded the correct recordset. I only get the error when I use the delete method. Here's my exact code:
<%
Dim adoCon
Dim rsCoupon
Dim strSQL
Dim lngRecordNo
lngRecordNo = Request.QueryString("ID")
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../fpdb/testcoupon.mdb")
Set rsCoupon = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Main.* FROM Main WHERE ID=" & lngRecordNo
rsCoupon.LockType = 3
rsCoupon.Open strSQL, adoCon
rsCoupon.Delete
rsCoupon.Close
Set rsCoupon = Nothing
Set adoCon = Nothing
Response.Redirect "ShowCoupons.asp"
%>