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

ASP, SQL 11.3.2009 No Comments

As I was maintaining some old ASP code for a client, we ran across the error below while migrating to a new site

Microsoft OLE DB Provider for ODBC Drivers error ’80040e23′
Row handle referred to a deleted row or a row marked for deletion.

classes.asp, line 346

Quite a cryptic message I think! The line in question was a simple select statement.
Line 346 was the objRS.open
dim strSQL
strSQL = "SELECT * FROM Classes INNER JOIN ClassBooks ON Classes.ClassID=ClassBooks.Class_ID"
objRS.open strSQL, objConn

Strange message considering we aren’t running a delete or update command anywhere.

After looking around the database, I realized that the ClassBooks table should have had the two FK fields in it (ClassID, BookID) setup as primary keys in the table. There were also a few records with a null BookID. After removing the null records and setting up the primary keys everything was fixed!

Leave a Reply