|
Hey everyone. I've been looking at this code forever and I can't figure it out.
I am trying to delete a record from a database, and I can get the ID to pass successfully, because Ic an see it up in the address bar, but I can't get it to actually delete.
When I run it I get this error:
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'annuityID='.
/backend/delete_record.asp, line 29
I know there is simple solution but obviously it isnt simple for me, because I am pulling my hair out over this one. Here is the ASP I'm using:
<%
'declare your variables
Dim Connection, sConnString
Dim sSQL, id
'get the id of the record sent through the querystring of the hyperlink
id=request.querystring("annuityID")
'Create an ADO connection object
Set Connection = Server.CreateObject("ADODB.Connection")
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=omitted"
dsn="dsn=omitted"
'Open the connection to the database
Connection.Open(sConnString)
'declare SQL statement that will query the database
'and which will be deleting the record with the id sent
sSQL="DELETE FROM tbl_annuity WHERE annuityID=" &id
'execute the SQL statement
Connection.execute(sSQL)
response.write "<div align='center'>The record was deleted.</div>"
'close the connection
connection.Close
Set connection = Nothing
%>
Feel free to abuse me with your words, but any help that you could offer would be greatly appreciated.
Thanks,
Alex
|