Home > Back-end >  There was a "not in manual or database operations under the distributed transaction is to creat
There was a "not in manual or database operations under the distributed transaction is to creat

Time:09-18

Using BCB + ADO when the data is stored, there will be a "not in a manual or distributed transaction mode to create a new connection" abnormal tips! The database server to SQLServer2005, SP4 patches has played, the client to submit code is as follows:
TADOQuery * pUpdate=dmLocal - & gt; PUpdate_gChpi2;
if(! PUpdate - & gt; Connection - & gt; InTransaction)
PUpdate - & gt; Connection - & gt; BeginTrans ();
Try
{
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();

//1. Insert table finished-parts storage
PUpdate - & gt; SQL - & gt; Add (" INSERT INTO gChpi2 (BoxNo BoxNum, spNo, inDate, OutFlag, TPID, EPCID, SJMZ, SJJZ, SJTJ) \
The select xh, fxnum, '" + lblHWId - & gt; Caption. The Trim () + "', getdate (), 0, '" + RFIDScanBillInfor [iIndex] sTuoPanId +"', EPCID, isnull (MXJZ, 0), isnull (MXJZ, 0) + isnull (XZZL, 0), isnull (XZC, 0) * isnull (XZK, 0) * isnull (XZG, 0) from DFXXH \
Where xh in (" + slstBoxNo + ") ");
PUpdate - & gt; ExecSQL ();

//2. Insert finished-product stock list
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
PUpdate - & gt; SQL - & gt; Add (" insert into gChpi2Mx (BoxNO scMxid, scCode, SCCF, color, pino, Num, poxh, Po) select a.x h, a.s cMXID, b.s cCode, a.s CCF, a.h color, \
Amy polumbo ino, a.f xnum, p. oxh, Amy polumbo o the from DXFMX a inner join DFXXH on a.x h=b b.x h and a.x h in (" + slstBoxNo + ") ");
PUpdate - & gt; ExecSQL ();
//3./location update status table
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
PUpdate - & gt; SQL - & gt; Add (" update kw set status=1, TPH='" + RFIDScanBillInfor [iIndex] sTuoPanId. The Trim () + "' where hw='" + lblHWId - & gt; Caption. The Trim () + "'");
PUpdate - & gt; ExecSQL ();

//4. Update box sign schedule of storage, warehousing application form
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
PUpdate - & gt; SQL - & gt; Add (" update DFXXH set rksign=1 where xh in (" + slstBoxNo + "); The update RCKQR set isok=1 where TPH='" + RFIDScanBillInfor [iIndex] sTuoPanId. The Trim () + "' and BQH (" + slstBoxNo + ") and in type='" + RFIDCheckBillInfor [iIndex] sDataType + "';" );
PUpdate - & gt; ExecSQL ();

PUpdate - & gt; Connection - & gt; CommitTrans ();
}
}
The catch (Exception & amp; Msg)
{
PUpdate - & gt; Connection - & gt; RollbackTrans ();
SEMsg="data save failed, please try again after checking!" + Msg. The Message;
BResult=false;
}
Cursorlocation connection is the default clUseClient
The probability of abnormal sometimes several times a day, the use of the system to the customer caused a lot of inconvenience, please master action! Thank you very much!

CodePudding user response:

Hair for a few days, how is still in the approval status?
  • Related