DataSet Transactions Help



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.


.



Relevant Pages

  • Re: DataSet Transactions Help
    ... >> parent and children DataTables related through key fields. ... >>> and as most of the table keys are Identity fields I had to write stored ... >>> transaction to the other Dataadapter commands such as its Read, ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: DataSet Transactions Help
    ... parent and children DataTables related through key fields. ... The datatables within the dataset have various datarelations setup ... > and as most of the table keys are Identity fields I had to write stored ... > Update commands. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DataSet Transactions Help
    ... > parent and children DataTables related through key fields. ... >> and as most of the table keys are Identity fields I had to write stored ... >> transaction to the other Dataadapter commands such as its Read, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Identiy retrieval within SqlCeTransaction
    ... within the same transaction? ... Table t1 and t2 has identity fields, ... Device Application Development MVP ... NullReferenceException ...
    (microsoft.public.sqlserver.ce)
  • Re: ExecuteNonQuery stops program
    ... Are these commands a part of a transaction? ... - Sahil Malik ... > exception not coming to the end of the method. ...
    (microsoft.public.dotnet.framework.adonet)

Loading