B
Brian Scott
I currently have a defined Datalayer in a C# application which is filled
with data on startup. All forms in the system bind the to this dataset data
source. The datatables within the dataset have various datarelations setup
and as most of the table keys are Identity fields I had to write stored
procedures on the server to return the new identity upon insert. This
required creating a new SqlCommand object that points at the stored
procedure and setting the Dataadpter insert command to this.
The issue is that because I had to write specific stored procedures due to
using Identity fields I now get an exception when I dont attach the
transaction to the other Dataadapter commands such as its Read, Delete and
Update commands. But these are never set and I thereby get a null reference
exception. I do not wish to create these other commands manually, only the
insert as I need the identity to come back out of the SQL Server upon
insert.
How do I implement Transactions on Dataset inserts where the datatable
contains an Identity field?
Thanks.
with data on startup. All forms in the system bind the to this dataset data
source. The datatables within the dataset have various datarelations setup
and as most of the table keys are Identity fields I had to write stored
procedures on the server to return the new identity upon insert. This
required creating a new SqlCommand object that points at the stored
procedure and setting the Dataadpter insert command to this.
The issue is that because I had to write specific stored procedures due to
using Identity fields I now get an exception when I dont attach the
transaction to the other Dataadapter commands such as its Read, Delete and
Update commands. But these are never set and I thereby get a null reference
exception. I do not wish to create these other commands manually, only the
insert as I need the identity to come back out of the SQL Server upon
insert.
How do I implement Transactions on Dataset inserts where the datatable
contains an Identity field?
Thanks.