By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

FK Constraint enforcement AFTER initial save of parent

P: n/a
Here's the deal. I have a Typed Dataset. For simplicity, we'll say it has 2 tables Parent and Child with a FK in Child, relationname = FK, cascade on update. Kyes are negative autoincrement.

I bind Parent to dgParent and I bind dgChild to the Parent table, FK datamember. The grids work properly, except in the following scenario.

1. Add a new row to the parent table. (PK = -1)
2. Save. The new Parent key is updated from the return value of the stored procedure.
3. Add a new row to dgChild for the row in the parent table. Receive FKConstraint error message saying the FK value -1 must exist in the parent table.

If I add the child row BEFORE saving, it works great, but in the above scenario, the currencymanager for the child doesn't seem to have gotten the message that it should be using a new FK value.

Thanks,
Chris
--------------------------------
From: Chris Waldmann

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>QhvQTronDUuropZxUS7XHA==</Id>
Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.