March 3, 2006 at 7:29 am
I have code which uses CRecordSets to add rows to a table.
This has been working perfectly OK in SQL Server 2000 and SQL Server 7. An example of the code is as follows:
CRecordset recordSet(m_DbSource);recordSet.Open("[_TABLE_C]", CRecordset::dynamic);recordSet.AddNew();recordSet.m_ID = 0;recordSet.m_Name = pThisRecord->csObjectName;recordSet.Update();
When I try this in SQL Server 2005 I get a CDBException with the following text:
"The cursor does not include the table being modified or the table is not updatable through the cursor. The statement has been terminated."
Can anyone suggest what I might be doing wrong?
March 6, 2006 at 8:00 am
This was removed by the editor as SPAM
March 6, 2006 at 6:27 pm
You could try removing the brackets (old bug: http://support.microsoft.com/kb/290413/EN-US/), or try different cursor types?
January 15, 2008 at 1:22 am
i have this problem too
rst.open "Select * from member where mem_ID=5",con,1,3
if rst.RecordCount<1 then
rst.AddNew
rst("Test")="A"
end if
rst("Test1")="B"
rst.update
rst.close
this example error on line "rst.update"
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC SQL Server Driver][SQL Server]The cursor does not include the table being modified or the table is not updatable through the cursor.
but run whit SQL 2000,Oracle 9i,MySQL. the error not show and success process.
help me for this problem if i can't resolve my company will change SQL2005 to Oracle
January 16, 2008 at 12:35 pm
Make sure the table has a primary key. MS's CRecordSet code will not open an updateable cursor without this.
While I know that the sequence you mention is the "planned" way of doing things using a CRecordSet, I'd strongly urge you to go to calling stored procedures to do these sorts of things, and move away from using cursor based updates through CRecordSet.
Steve G.
------------------------
Step away from the cursor and no one gets hurt ...
August 13, 2008 at 12:43 pm
We had a similar problem. it's not completely resolved, but it looks like the cursor had an empty record set.
The more you are prepared, the less you need it.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply