artsapimp
Mar 7th, 2001, 01:43 PM
I am having trouble deleting records from an Access database using the following code. There are 2 SQL statements.
1 - Deletes the record indicated in the QueryString
2 - Deletes all records where the length of one field is less than 3
Here's the code
<%
Dim cnn
Dim rst
Dim ConnectString
Dim strSQL
Dim strDelSQL
Set cnn = Server.CreateObject("ADODB.Connection")
Set rst = Server.CreateObject("ADODB.Recordset")
ConnectString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath("database/tickets.mdb")
strSQL = "DELETE * FROM RRS_Tickets WHERE TicketID = " & Request.QueryString("Record")
strDelSQL = "DELETE * FROM Tickets WHERE Len(Ticket_Number) < 3"
cnn.Open ConnectString
rst.Open strDelSQL, cnn, 2, 2
rst.Close
rst.Open strSQL, cnn, 2, 2
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Response.Redirect("Tickets.asp")
%>
Here's the error I'm getting
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed if the object is closed.
?
Thank you for any help.
1 - Deletes the record indicated in the QueryString
2 - Deletes all records where the length of one field is less than 3
Here's the code
<%
Dim cnn
Dim rst
Dim ConnectString
Dim strSQL
Dim strDelSQL
Set cnn = Server.CreateObject("ADODB.Connection")
Set rst = Server.CreateObject("ADODB.Recordset")
ConnectString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath("database/tickets.mdb")
strSQL = "DELETE * FROM RRS_Tickets WHERE TicketID = " & Request.QueryString("Record")
strDelSQL = "DELETE * FROM Tickets WHERE Len(Ticket_Number) < 3"
cnn.Open ConnectString
rst.Open strDelSQL, cnn, 2, 2
rst.Close
rst.Open strSQL, cnn, 2, 2
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Response.Redirect("Tickets.asp")
%>
Here's the error I'm getting
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed if the object is closed.
?
Thank you for any help.