Hi all.
I am trying to delete a record from my Access database. I have all the selection pages set up, I just need help on my page that actually deletes the record. In that page, I have the following SQL code
Code:
<%
Dim Conn
Dim Rs
Dim sql
'Create an ADO connection and recordset object
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
'Set an active connection and select fields from the database
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/mypathtodatabase/database.mdb")
sql= "DELETE * FROM tblNews WHERE id="& Request.QueryString("id") &""
Rs.Open sql
Rs.Close
Set Rs = Nothing
%>
The problem is, when I try to delete a record using this page, I get the following error.
ADODB.Recordset error '800a0e7d'
The connection cannot be used to perform this operation. It is either closed or invalid in this context. /administrator2/delete/news/process/default.asp, line 23
Thanks.
|