Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 database,
oracle transaction with multi OracleConnection c #
Table 1 in the database 1

Table 2 in the database 2

When save new data to Table 1, I want to save the data in Table 2 in the database 2
How can I do this in oracle transaction
 (OracleConnection connection1 = new OracleConnection(connectionstring1) )// databsse1
            {OracleConnection connection2=new OracleConnection (connectionstring2);//database2
                connection.Open();

                OracleCommand command = connection.CreateCommand();
                OracleTransaction trans;

                trans = connection.BeginTransaction(IsolationLevel.ReadCommitted);
                command.Transaction = trans;
                try
{
command.Text =sql1//insert into table1 in database1
 command.ExecuteNonQuery();
command.Text =sql2//insert into table2 in database2
//Here the problem by looking for a solution
How can I do that
trans.Commit();
}
catch (Exception ex)
                {

                    trans.Rollback();
                }
            } 
Posted
Updated 17-Feb-14 11:58am
v2
Comments
The14thNoah 17-Feb-14 19:45pm    
is your Table1 in database 1 is same/replicate to Table2 in database 2?
ZurdoDev 17-Feb-14 21:39pm    
Where are you stuck?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900