This is a pretty good alert, isn’t it ?
Well, in the beginning it was not to me.
My ASP page were running some very easy query,something like this:
SELECT TA.fieldA, TB.fieldB
FROM tableA AS TA LEFT JOIN tableB AS TB ON TA.idA = TB.idB
but the only answer I gave was
Microsoft OLE DB Provider for ODBC Drivers error ’80040e23′
Row handle referred to a deleted row or a row marked for deletion.
That query run very fine on SQL SERVER Management Studio, on OSQL comand line and, quite similar, in a couple other ASP pages, plus VB component.
That’s funny, but not for me.
After some tests, SELECT statement on single table run well, but not the whole query.
I just had a look to the internet knowledge, and found this post on msdn forums: Problem with View migrated from SQL Server 2000 into 2005.
These words lighted my way:
How ADO handles the optimistic locking is it needs to know how to identify the row that is being updated and also how to identify what determines the record has changed so that it can verify the update. However your dtComments table doesn’t have a PK thus the problem. ADO does try and obtain the information needed in the absence of a PK but this is what is causing the problem.
Putting a PK should be your answer, all tables should have one unless a specific reason not to.
Do a 10 rows table have to have a primary key ? Of course!
I hope I shall remind of it next time.
Technorati tags: ADO, Primary Key