Here I will post problems I and my colleagues met and solutions we found.

Tuesday, February 22, 2005

Master/detail part I

My first problems, or better to say question, began with master detail. At the beginning, everything looked very simple from documentation. The key word is DataRelation, everything seemed obvious.

However, in my case I had two tables, contacts with primary key contact_id, which was autoident field and contact_addresses with primary key contact_id and comtact_address_id, where contact_address_id was autoident field. Both tables were created in one dataset and relation was set.

To get id values from server, my insert SQL command followed by "select contact_id, .... from contacts where contact_id = @@identity";
Same for contact_addresses.

My first mistake was that I cleared Update rule to None. In result, when new contact_id value was obtained from server, it remained old one in details.

You may find detail description of this problem and solution here:
http://www.dotnet247.com/247reference/msgs/47/237357.aspx

No comments: