View Single Post
  #9 (permalink)  
Old 12-02-2008, 12:16 AM
Stonkie Stonkie is offline
VB.NET Forum Master
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Sep 2007
Age: 22
Posts: 279
Reputation: 80
Stonkie probably authored a book by nowStonkie probably authored a book by nowStonkie probably authored a book by now
Default

It is possible that that person's problem (and maybe yours) is that he didn't set the relation in the dataset designer to "ON UPDATE CASCADE". You must do this manually so when the data is refreshed from the database when you insert the master row, it updates the id of the master row and the detail's foreign key refering to the row is updated as well (instead of remaining to -1 which is not a real master row).

To change this setting in the dataset designer, double click on the lines that appear between your tables and you will have access to the relationship's properties.

Maybe this is what is happening to you? I always thought this should have been the default to begin with, but I think it takes the settings from your database. And since in real life, the id from your database will never change, you don't need to do this on your database, only on the dataset.
__________________
The human mind's capability to comprehend abstract concepts is limited to the vocabulary it can use to describe it. The more precise the building blocks, the more complex the thoughts that can emerge... Sounds like the evolution of programming languages doesn't it?
Reply With Quote