OLE DB: Error update row 
Author Message
 OLE DB: Error update row

When I try to update a row of table a (using CRowset::SetData or
CRowset::Update) which is refrencend by table b having a foreign
key on table a, I receive a foreign key violation on table b.
But I'm not changing the column of table a which is used as the
reference column by table b. Even setting the status of that
column to DBSTATUS_S_IGNORE won't help.

Using an SQL update statement on table a which sets the column
to its old value (update a set key = 1 where key = 1) works fine.

The database system is MS SQL Server 6.5.

Can anyone give me a hint?

Thanks in advance


P.S. Sorry if the message is posted two times, but posting it the
first time I had some problems and didn't saw whether it worked
or not.

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.*-*-*.com/ ;  The website for Visual C++ programmers.

Sat, 22 Dec 2001 03:00:00 GMT  
 OLE DB: Error update row

After doing some investigations on the MSDN library I think I can give a more concrete description:

The error seems to match to the description of MSDN article Q150874 which is talking about deferred constraint checking.

I'm receiving the same error messages described here: "Msg 547, Level 16, State 2 UPDATE statement conflicted with COLUMN REFERENCE constraint ..." when DISABLE_DEF_CNST_CHK is set ON, not exactly a foreign key violation error text.

Opening a CCommand with "SET DISABLE_DEF_CNST_CHK OFF" before trying to make the update using another CCommand won't help. The setting of the server is default: off.

I thought there would be a CDBProp property to set this explicitly to off, but I hadn't found one.

Perhaps this description helps to get on with it.

Again thanks in advance for any hint.


-----------------** -- Posted from CodeGuru -- **-----------------
http://www.codeguru.com/    The website for Visual C++ programmers.

Tue, 25 Dec 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Insert, Update, Delete of rows using OLE DB ATL Consumer Templates

2. Insert rows with OLE DB template?

3. VC++.NET OLE DB Unmanaged Code samples (How to Update Data)

4. OLE DB From VC++ 6.0 Delayed Update Problem on Insert

5. how to update Memo field with OLE DB.

6. OLE DB Cannot update record

7. Q: Error message "Multiple rows updated"???

8. ODBC: "Multiple rows were updated" ERROR

9. single row updates effect multiple rows....

10. Row update SQL error

11. ole db error

12. insert : Multiple-step OLE DB operation generated errors


Powered by phpBB® Forum Software