작업중인 웹 서비스 중 하나에서이 재발생 문제가 발생했습니다. 데이터 어댑터를 사용하여 트랜잭션 및 일괄 업데이트를 사용하고 있습니다. 또한 Oracle Command Builder를 사용하여 dataadapter에 할당 한 삽입/삭제/업데이트 명령을 얻습니다.트랜잭션 객체가 연결 객체와 연결되어 있지 않습니다. - OracleClient
내 서비스에서 추출한 코드는 다음과 같습니다. 에러 라인 :이
마음 - 내 소스에서 추출한 코드를 게시하도록하겠습니다이 : 위에서 언급 한 바와 같이
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 < 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);
}
그래서 - 나는 예외를 얻을 "트랜잭션 객체는 연결과 관련되지 않았습니다 object "위의 줄에 : da.InsertCommand = cmdInsert.GetInsertCommand();
이 문제에 대한 도움은 매우 감사하겠습니다. 더 많은 정보가 필요하시면 친절하게 알려주십시오.
미리 감사드립니다.
우와 - 가능할 수도 있습니다! 확인하겠습니다. 그리고 다시 연락 드리겠습니다. –
브라보! 그것은 트릭을했다. 무리 감사! 건배 –
Thx는 제 3 자 소프트웨어에 대한 문제를 이해하는 데 큰 도움이되었습니다. – boutta