I wanted to know the proper way to code using the starttransaction, commit/rollback functionality of the SDAC.
Code: Select all
case 2: { // custom Method == 2
Refresh();
MSQuery->SQL->Clear();
MSQuery->SQL->Add(DB->CustomQueryString);
try {
MSQuery->Execute();
} catch (EMSError &E) {
Answer = false;
char ErrorMsg[2048];
UpString(ErrorMsg,E.Message.c_str());
if (strstr(ErrorMsg,"PRIMARY KEY CONSTRAINT") == NULL) {
sprintf(ErrorMsg,"Key Convert Error: %s",E.Message.c_str());
DB->DBErrorNote(ErrorMsg);
iSET->WriteToDBLog(ErrorMsg);
}
}
if (MSQuery->RecordCount > 0) {
Data.ErrorCodeID = MSQuery->Fields->Fields[0]->AsString;
Data.ToDescription = MSQuery->Fields->Fields[1]->AsString;
Answer = true;
} else {
Data.CartonID = "";
}
MSQuery->Close();
break;
} // END of Method 2
A secondary question is, will this adversly affect other queries running against this database? The above function could be called from multiple places and multiple applications against the database. Thank you in advance for your help.
I'm using Borland C++ Builder 6.0 pro and the sdac 4.8.
Ben