oracle transaction with multi OracleConnection c # ?
-
I have 2 database,
oracle transaction with multi OracleConnection c #
Table 1 in the database 1Table 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 transactionusing (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(); } }
-
I have 2 database,
oracle transaction with multi OracleConnection c #
Table 1 in the database 1Table 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 transactionusing (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(); } }
-
I have 2 database,
oracle transaction with multi OracleConnection c #
Table 1 in the database 1Table 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 transactionusing (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(); } }
Just a thought. if the tables structures are the same have you not thought about using database triggers?[^]
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON