Reply
The connection cannot be used to perform this operation.
Old 03-22-2007, 08:33 PM The connection cannot be used to perform this operation.
Novice Talker

Posts: 10
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.Recordseterror '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.
kw91 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-23-2007, 03:30 AM Re: The connection cannot be used to perform this operation.
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
The record may or may not be deleted in the database; I think Access is more finicky than SQL Server, and likely to abort the whole transaction.

It looks like the problem is you're trying to open not just the connection you need to execute your SQL command, but you're trying to open a recordset from a command that won't return data.

It's been too long since I've done much programming in Access for me to walk you through the code, but I think you want conn.execute, or something like that.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to The connection cannot be used to perform this operation.
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11200 seconds with 12 queries