TTransactionDesc Tr;
Tr.TransactionID = 1;
Tr.IsolationLevel = Sqlexpr::xilREADCOMMITTED; //the problem, i found
SqlExpr in some help!
kCn->StartTransaction(Tr);
//.... your updates / insert / deletes...
kCn->Commit(Tr);
That is all.
> For the people that need transactions this work (how many try and error!!)
Note that your code shows the pre-DBX4 way (the deprecated way) of using
transactions in dbExpress...
Prior to DBX4, we had to call the StartTransaction, Commit, and RollBack
methods of TSQConnection. However, these methods are now deprecated, and
we should now use the new (DBX4) methods called BeginTransaction,
CommitFreeAndNil, and RollBackFreeAndNil of the TSQLConnection component
instead of the deprecated methods.
And you need to use DBXCommon and SqlExpr now instead of the dbExpress unit.
Groetjes,
Bob Swart
--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml
now:
// resto cmoddb5
//---------------------------------------------------------------------------
__fastcall XTDM::XTDM()
{
//MLG.NameMLg(ExtractFileName(Application->ExeName).Sub
// String(1, cFN.Pos(".")-1));
kCn = new TSQLConnection(0);
kCn->DriverName = "MySQL";
kCn->LibraryName = "dbxmys30.dll";
kCn->VendorLib = "libmysql.dll";
kCn->GetDriverFunc = "getSQLDriverMYSQL";
kCn->LoginPrompt = false;
Rs = NULL;
lOk = nLG = 0; //nlr = 0;
}
//---------------------------------------------------------------------------
__fastcall XTDM::~XTDM()
{
if (Rs) { //nlr>0)
Rs->Close();
delete Rs;
}
if (kCn->Connected)
kCn->Close();
lOk = nLG = 0;
delete kCn;
}
//---------------------------------------------------------------------------
void XTDM::OpenCn()
{
kCn->Open();
}
//---------------------------------------------------------------------------
void XTDM::BeginTrans()
{
//TDBXTransaction *Tr private to XTDM
Tr = kCn->BeginTransaction();
}
void XTDM::CloseCn()
{
if (kCn->Connected)
kCn->Close();
}
void XTDM::CommitTrans()
{
kCn->CommitFreeAndNil(Tr);
}
void XTDM::RollbackTrans()
{
kCn->RollbackFreeAndNil(Tr);
}
//...more metod...
I tried that code and work ok (like before but...)
Thank again
Juanma
"Bob Swart" <B...@BobSwart.com> escribió en el mensaje
news:46DC1977...@BobSwart.com...