UpdateAll with hierarchical updates and Identity columns

F

Frank Hauptlorenz

Dear all,

I have a problem with updating (to keep it simple to explain) 2 tables
which are related.
Table one contains parts and table two contains their relations. Table
two has foreign keys to the parts.
The parts are auto generated and get negative numbers within the
application.

Now comes the UpdateAll() of the TableAdapterManager which also tries to
update the tables within the correct order:
first it inserts the parts in table one which is working but then it
tries to insert into table 2 which breaks, because of a foreign key
violation.

It seems to me that the new part ID's are not forwarded to table two, so
the TableAdapterManager tries to insert the wrong part Id's.
How can this be managed?

Thanks for responding!
Frank
 
F

Frank Hauptlorenz

Dear all,

I've found the solution: within the DataSet I must enable the update
cascading. Although I don't want this within the database table.
Is this a feature?

Frank
 
C

Colbert Zhou [MSFT]

Hello Frank,

Yes. This is a by design feature of Visual Studio 2008 typed dataset. Only
when its Hierarchical Update property set to true, we can use
TableAdapterManager to update the server data hierarchically.

Actually, typed dataset's Hierarchical Update property is by default set to
True in VS2008. And we need manually to set this property to make previous
version of dataset can be updated hierarchically. See the following MSDN
document for more detailed information,
http://msdn.microsoft.com/en-us/library/bb629327.aspx


Best regards,
Colbert Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
 
F

Frank Hauptlorenz

Hi Colbert,

no, hierarchical update was turned on. You need to enable *cascading
updates* within the DataSet. Also when
I do not allow it within the DataBase. This is a little bit unlogical.

Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top