I'm trying to delete entries from my SQL Server database but I get the error message:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near '*'.
/AcSec/delete.asp, line 19
I am using classic ASP. Please see my 'delete.asp' attached.
I'm doing it like this:
<a href="Update.asp?key=<%= rs("ID")%>">Delete</a>
This method worked fine when I was using MS Access database, but since I switched to SQL Server it doesn't work. Would you please let me know how to change the code in the 'delete.asp' in order to be able to delete entries? Thank you very much for your help.
Dim adoCon 'Holds the Database Connection Object
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be deleted
'Read in the record number to be deleted
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "DELETE * FROM Results WHERE ID=" & lngRecordNo
'Reset server objects
Set adoCon = Nothing
'Return to the delete select page incase another record needs deleting