By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 968 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Row handle referred to a deleted row -- error message

P: n/a
Hi

I am a relative beginner with SQL and ASP. With some help after
previous posts I have a page which successfully requests querystrings
from another page and deletes a record from an access table, However, I
get the error message:

"Row handle referred to a deleted row or a row marked for deletion"

I am using access 2002, the table only has 2 fields (ContactID and
GroupID, both numeric and joint Primary Keys.

I have another page which successfully deletes a record from another
table with no problems.

I have listed the full code below.

I would grealtly appreciate any help available.

Thanks Colin

<%
' LeaveGroup.asp is called by LeaveGroupSelect.asp and deletes the
selected record from the database-->

'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGC1 'Holds the recordset for the record to be deleted
Dim strSQL 'Holds the SQL query to query the database
Dim GroupID
Dim ContactID

'Read in the GroupID to be deleted
GroupID = Request.QueryString("GroupID")

'Read in the ContactID to be deleted
ContactID = Request.QueryString("ContactID")

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("../databases/GC1.mdb")

'Create an ADO recordset object
Set rsGC1 = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database

strSQL = "SELECT * FROM tblGroupContact WHERE ContactID = " & ContactID
& " AND GroupID = " & GroupID

'Set the lock type so that the record is locked by ADO when it is
deleted
rsGC1.LockType = 3

'Open the recordset with the SQL query
rsGC1.Open strSQL, adoCon

'Remove this group from the members list
rsGC1.Delete

'The response.write's below were used to verify the values below - when
setting up sql
' When activated they confirm that the correct values are being
modified / deleted
'and the correct record is actually deleted from the database - beu
then I get the error message
'Row handle referred to a deleted row or a row marked for deletion
%>
'<%Response.Write (rsGC1("ContactID"))%><p>
'<%Response.Write (rsGC1("GroupID"))%><p>

'<%Response.Write ContactID%><P>
'<%Response.Write GroupID%><P>

<%
'Reset server objects
rsGC1.Close
Set rsGC1 = Nothing
Set adoCon = Nothing

Response.Redirect "LeaveGroupconfirm.asp"
%>

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

<ia****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi

I am a relative beginner with SQL and ASP. With some help after
previous posts I have a page which successfully requests querystrings
from another page and deletes a record from an access table, However, I
get the error message:

"Row handle referred to a deleted row or a row marked for deletion"

I am using access 2002, the table only has 2 fields (ContactID and
GroupID, both numeric and joint Primary Keys.

I have another page which successfully deletes a record from another
table with no problems.

I have listed the full code below.

I would grealtly appreciate any help available.

Thanks Colin

<%
' LeaveGroup.asp is called by LeaveGroupSelect.asp and deletes the
selected record from the database-->

'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGC1 'Holds the recordset for the record to be deleted
Dim strSQL 'Holds the SQL query to query the database
Dim GroupID
Dim ContactID

'Read in the GroupID to be deleted
GroupID = Request.QueryString("GroupID")

'Read in the ContactID to be deleted
ContactID = Request.QueryString("ContactID")

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("../databases/GC1.mdb")

'Create an ADO recordset object
Set rsGC1 = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database

strSQL = "SELECT * FROM tblGroupContact WHERE ContactID = " & ContactID
& " AND GroupID = " & GroupID

'Set the lock type so that the record is locked by ADO when it is
deleted
rsGC1.LockType = 3

'Open the recordset with the SQL query
rsGC1.Open strSQL, adoCon

'Remove this group from the members list
rsGC1.Delete

'The response.write's below were used to verify the values below - when
setting up sql
' When activated they confirm that the correct values are being
modified / deleted
'and the correct record is actually deleted from the database - beu
then I get the error message
'Row handle referred to a deleted row or a row marked for deletion
%>
'<%Response.Write (rsGC1("ContactID"))%><p>
'<%Response.Write (rsGC1("GroupID"))%><p>

'<%Response.Write ContactID%><P>
'<%Response.Write GroupID%><P>

<%
'Reset server objects
rsGC1.Close
Set rsGC1 = Nothing
Set adoCon = Nothing

Response.Redirect "LeaveGroupconfirm.asp"
%>

Normally, you would simply execute a delete query (not create a recordset)
and examine how many records were affected. Obviously if this is exactly
one record, working out whether it worked or not is easy, but in your case
perhaps you can at least be sure it's more than zero.

strSQL="DELETE FROM tblContact WHERE ConID=102"
On Error Resume Next
cnnADO.Execute strSQL, lngRecs
On Error Goto 0
If lngRecs=1 Then
Response.Write "Deleted"
Else
Response.Write "Error Deleting Record"
End If


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.