title: The transaction object is not associated with the connection object - OracleClient
body: <p>I have this reoccurring problem with one of the Web Services I'm working on.
  I am using Transactions and Batch Update using Data Adapters. On top of that I am also using Oracle Command Builder to get my insert/delete/update commands which I assign to the dataadapter.</p>
  
  <p>Here is some extracted code from my service; and with the error line:</p>
  
  <p>Mind it - I'm posting code extracted from my source:</p>
  
  <pre><code>OracleTransaction trx = null;
  if ((Transaction.Current.TransactionInformation.DistributedIdentifier == Guid.Empty))
                  {
                      con.ConnectionString = con.ConnectionString + ";enlist=false"; ;
                      con.Open();
                      trx = con.BeginTransaction();
                      cmd.Transaction = trx;
                  }
  
                  try
                  {
                      dsEmpData.AcceptChanges();
                      for (int i = 0; i &lt; dsEmpData.Tables[0].Rows.Count; i++)
                      {
                          dsEmpData.Tables[0].Rows[i].SetAdded();
                      }
                      OracleCommandBuilder cb = new OracleCommandBuilder();
                      string SQL
                              = "--MY SELECT COMMAND. REMOVED BECAUSE IT IS NOT NECESSARY IN THIS BLOCK";
  
                      OracleDataAdapter da = new OracleDataAdapter(SQL, ConnectionString);
                      OracleCommandBuilder cmdInsert = new OracleCommandBuilder(da);
                      dsEmpData.Tables[0].TableName = "TABLENAME".ToUpper();
  
                      if ((Transaction.Current.TransactionInformation.DistributedIdentifier == Guid.Empty))
                      {
                          da.SelectCommand.Transaction = trx;
                          da.InsertCommand = cmdInsert.GetInsertCommand();//ERROR LINE
                          da.InsertCommand.Transaction = trx;
                      }
                      da.Update(dsEmpData, "TABLENAME".ToUpper());
                      if (trx != null)
                      { trx.Commit(); }
                  }
                  catch (Exception ex)
                  {
                      if (trx != null)
                      { trx.Rollback(); }
                      throw new FaultException("MY MESSAGE " + ex.Message);
                  }
  </code></pre>
  
  <p>So, as stated above - I get the exception "The transaction object is not associated with the connection object" on the above stated line: da.InsertCommand = cmdInsert.GetInsertCommand();</p>
  
  <p>Any help on this matter will be highly appreciated. If you need more information, kindly let me know.</p>
  
  <p>Thanks in advance.</p>