ADO.NET cross-base transactions Pin
I made a simple transaction using ADO.NET:
SqlTransaction tn;
SqlConnection cn = new SqlConnection(/*connection string to 'Database1'*/);
try {
if (cn.State != ConnectionState.Open)
{
cn.Open();
}
}
catch (SqlException ex)
{
Debug.Assert(false, ex.ToString());
}
tn = cn.BeginTransaction();
SqlCommand cmd2 = ...
This works nicely. However I would like to make some update statement in other database - 'Database2'. Is it possible to do that inside one ADO.NET transaction? If so, how?
Thank you for help in advance.
Re: ADO.NET cross-base transactions Pin
Check out TransactionScope.