CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BCB 3 Transactions and Informix DB





I am trying to start a transaction with an Informix database.  So far I have
not been too successful.

I get the following error message: "Project Project1.exe raised exception
class EDBEngineError with message 'Operation not applicable. Transaction
not available.'. Process stopped. Use Step or Run to continue."

I have TQuery, TDatabase, TButton and the code at bottom of message.

Any help would be greatly appreciated!

Thanks,

Eric

void __fastcall TForm1::Button1Click(TObject *Sender)
{
        dbBookInv->Close();
        dbBookInv->AliasName = "client";
        dbBookInv->Params->Values["USER"] = "informix";
        dbBookInv->Params->Values["PASSWORD"] = "aaaa";
        dbBookInv->LoginPrompt = false;
        dbBookInv->DatabaseName = "xxx";

        qBookInv->DatabaseName = dbBookInv->DatabaseName;

        dbBookInv->Open();
        dbBookInv->StartTransaction();

        try
        {
                qBookInv->Close();
                qBookInv->SQL->Clear();
                qBookInv->SQL->Add("UPDATE order SET status = 2");
                qBookInv->SQL->Add(" WHERE ord_no between :first AND :last
AND");
                qBookInv->SQL->Add(" status = 0");
                qBookInv->ParamByName("first")->AsString = "232222222";
                qBookInv->ParamByName("last")->AsString = "232222222";
                qBookInv->Prepare();
                qBookInv->ExecSQL();
        }
        catch (...)
        {
                dbBookInv->Rollback();
                throw;
        }

        dbBookInv->Commit();

        qBookInv->Close();
        dbBookInv->Close();

}


W Komornicki's Home Page | Main Index | Thread Index