OLE DB Error when performing DELETE

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jeremyw
Posts: 32
Joined: Thu 29 Apr 2010 17:32

OLE DB Error when performing DELETE

Post by jeremyw » Thu 29 Apr 2010 23:58

I'm attempting to delete rows from two of my tables. The tables have a one-to-many relationship, and I've attached a screenshot of their definition and relationship so you can see how they're structured.

The second table has a foreign key into the first, and the "ON DELETE" rule for this relationship is set to "CASCADE". In other words, when I delete a row from the first "parent" table, any linked rows in the second "child" table should automatically be deleted as well. This is in fact what happens when I perform simple SQL DELETE statements from the MS SQL Server Management utility.

However, when executing the same commands via a TMSSQL component from the SDAC library, I get the following OLE DB error. Based on MS documentation, the error code provided means the following:
0x00040EDC 265948
Updating this row caused more than one row to be updated in the data source
Any idea why the delete won't work properly using the SDAC component? I can always go and delete the linked rows first from the child table, but why should I have to if I've properly established an ON DELETE CASCADE relationship?

Image[/img]

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 30 Apr 2010 10:50

I can not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including script to create database objects.

Also supply me the following information:
- the exact version of SDAC. You can see it in the About sheet of TMSConnection Editor;
- the exact version of your IDE;
- the exact version of SQL server and client. You can see it in the Info sheet of TMSConnection Editor.

Post Reply