Hi How do i use transaction with typed dataset? Let us say I have an archive table and record detail table and I have in order to save one out of the record table and all sorts of the particulars within the record detail table. How do i use ? I discovered transaction may be used with untyped dataset however i aren't seeing it with typed dataset. Can someone let me know the way i must do?

Kevin

There is a nice article (and code) at CodeProject regarding how to extend the typed dataset make it possible for transactions without getting them get marketed to some distributed transaction while using the TransactionScope.

Summary: Make use of the transaction scope having a method added around the partial class to change the actual SqlCommand objects to get familiar with exactly the same transaction.

using (SqlTransaction transaction = connection.BeginTransaction())
{
       // These methods will update all relevant command objects’ transaction property
       adapter1.EnlistTransaction(transaction);
       adapter2.EnlistTransaction(transaction);

       adapter1.Update(table1);
       adapter2.Update(table2);

       transaction.Commit();
}

Code example for adapter from reference:

public partial class [TableAdapterName]
{
    public void EnlistTransaction(System.Data.SqlClient.SqlTransaction transaction)
    {
        System.Data.SqlClient.SqlTransaction _transaction;

        if (this._transaction != null)
        {
            throw new System.InvalidOperationException
        ("This adapter has already been enlisted in a transaction");
        }
        else
        {
            this._transaction = transaction;
            Adapter.UpdateCommand.Transaction = _transaction;
            Adapter.InsertCommand.Transaction = _transaction;
            Adapter.DeleteCommand.Transaction = _transaction;
        }
    }
}

You should use TransactionScope and call both updates inside the scope from the TransactionScope object.

Please visit the example provided within this link. TransactionScope.

An more close example is supplied here.