Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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
Trades: 0
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
 
 
Register now for full access!
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,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
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 Search this Thread
Search this Thread:

Advanced Search

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

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





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



Page generated in 0.10115 seconds with 12 queries