Click here to Skip to main content
15,886,518 members
Home / Discussions / C#
   

C#

 
AnswerRe: Populating Data from MS Access Pin
haroon19803-Mar-09 11:38
haroon19803-Mar-09 11:38 
QuestionWriting SQL statement in C# Pin
Deepali Khalkar3-Mar-09 6:39
Deepali Khalkar3-Mar-09 6:39 
AnswerRe: Writing SQL statement in C# Pin
Yusuf3-Mar-09 8:32
Yusuf3-Mar-09 8:32 
QuestionCannot use Java generated DES Key in C# Pin
karpolu3-Mar-09 6:13
karpolu3-Mar-09 6:13 
AnswerRe: Cannot use Java generated DES Key in C# Pin
Calin Tatar3-Mar-09 10:02
Calin Tatar3-Mar-09 10:02 
AnswerRe: Cannot use Java generated DES Key in C# Pin
karpolu3-Mar-09 11:33
karpolu3-Mar-09 11:33 
QuestionDefault oreintation landscape ,datetime and Tabname in the footer when user print the excel sheet by default. Pin
vikram_asv3-Mar-09 5:59
vikram_asv3-Mar-09 5:59 
QuestionTableAdapter and Transactions. [modified] Pin
hdv2123-Mar-09 5:50
hdv2123-Mar-09 5:50 
Hi I want to use Transactions with TableAdapter class which visual studio dataset designer create for each database objects (tables,...).
i found this article to do this : http://blah.winsmarts.com/2006/06/18/the-definitive-tableadapters--transactions-blog-post.aspx[^]

now u can use transactional tableAdapter like this :
CustomersTableAdapter tableAdap = new CustomersTableAdapter() ;
SqlTransaction tableAdapTran = null ;
SqlConnection tableAdapConn = null ;

try
{
    tableAdapConn = tableAdap.OpenConnection() ;
    tableAdapTran = tableAdapConn.BeginTransaction() ;

    // Do your transactional work

    tableAdapTran.Commit() ;
}
catch (Exception)
{
    tableAdapTran.Rollback() ;
}
finally
{
    tableAdapConn.Close() ;
}

this works fine when u want working with a one TableAdapter. for multuple tableAdapters, u need extend each tableAdapter class for supporting Transactional operation.
In my scenario : i'm dealing with multiple tables (insert,update or delete to/from multiple tables) within a single transaction and i think above method does not correct for this operation. look at this code sample :

CustomersTableAdapter tableAdap = new CustomersTableAdapter() ;
SqlTransaction tableAdapTran = null;
SqlConnection tableAdapConn = null;

OrdersTableAdapter ordersAdapter = new OrdersTableAdapter();
SqlTransaction ordersAdapterTran = null;
SqlConnection ordersAdapterConn = null;

try
{
    tableAdapConn = tableAdap.OpenConnection();
    tableAdapTran = tableAdapConn.BeginTransaction();

    ordersAdapterConn = ordersAdapter.OpenConnection();
    ordersAdapterTran = ordersAdapterConn.BeginTransaction();


    // What i must write here ?


    tableAdapTran.Commit();
}
catch (Exception)
{
    tableAdapTran.Rollback();
}
finally
{
    tableAdapConn.Close();
}


can anybody help me about this issue ?
Note : i don't want to use TransactionScope class.
thanks

modified on Tuesday, March 3, 2009 11:56 AM

QuestionError Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 3:45
Mustafa Ismail Mustafa3-Mar-09 3:45 
AnswerRe: Error Loading type during runtime Pin
Eddy Vluggen3-Mar-09 3:55
professionalEddy Vluggen3-Mar-09 3:55 
GeneralRe: Error Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 3:59
Mustafa Ismail Mustafa3-Mar-09 3:59 
GeneralRe: Error Loading type during runtime Pin
Eddy Vluggen3-Mar-09 4:10
professionalEddy Vluggen3-Mar-09 4:10 
GeneralRe: Error Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 4:11
Mustafa Ismail Mustafa3-Mar-09 4:11 
AnswerRe: Error Loading type during runtime Pin
J4amieC3-Mar-09 4:31
J4amieC3-Mar-09 4:31 
GeneralRe: Error Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 4:38
Mustafa Ismail Mustafa3-Mar-09 4:38 
AnswerRe: Error Loading type during runtime Pin
Yusuf3-Mar-09 4:36
Yusuf3-Mar-09 4:36 
GeneralRe: Error Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 4:39
Mustafa Ismail Mustafa3-Mar-09 4:39 
GeneralRe: Error Loading type during runtime Pin
Yusuf3-Mar-09 4:49
Yusuf3-Mar-09 4:49 
GeneralRe: Error Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 4:52
Mustafa Ismail Mustafa3-Mar-09 4:52 
AnswerRe: Error Loading type during runtime Pin
Mustafa Ismail Mustafa3-Mar-09 4:55
Mustafa Ismail Mustafa3-Mar-09 4:55 
GeneralRe: Error Loading type during runtime Pin
Yusuf3-Mar-09 5:02
Yusuf3-Mar-09 5:02 
QuestionPanel Event Pin
Cliffer3-Mar-09 3:13
Cliffer3-Mar-09 3:13 
AnswerRe: Panel Event Pin
Calin Tatar3-Mar-09 3:34
Calin Tatar3-Mar-09 3:34 
GeneralRe: Panel Event [modified] Pin
Megidolaon4-Mar-09 2:30
Megidolaon4-Mar-09 2:30 
QuestionOdd Referencing Problem Pin
Jammer3-Mar-09 1:55
Jammer3-Mar-09 1:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.