Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 2 of 2 total |
Transaction / Cannot perform this operation on a closed database |
Fri, Jan 11 2013 6:53 PM | Permanent Link |
IQA | Hi All,
Wondering if anyone would know of a reason why a TRANSACTION would cause the Database to close? If I remove the transaction lines of code so its no longer running in a transaction, then all the records are added perfectly in the FOR loop as expected. But as soon a I have it running in a transaction, the database is disconnected after the first INSERT. Basically here's a simplistic idea of what I have: // Connect database CDSDatabase->Connected = true; CDSDatabase->StartTransaction(Tables); try { for (int x = 0; x < whatever; x++) { EDBQuery being used to insert a record // PROBLEM occurs here after FIRST record is inserted, then raises the error: "Cannot perform this operation on a closed database" } CDSDatabase->Commit(); } catch (Exception &exception) { CDSDatabase->Rollback(); } // Disconnect database CDSDatabase->Connected = false; |
Fri, Jan 11 2013 10:24 PM | Permanent Link |
IQA | All good, I found the problem was the database was closing automatically
during the transaction, because I had the EDBDatabase->KeepConnection = false (which I have set for a reason in the program)... So just for this function I set the KeepConnection = true and it works as expected. Cheers! |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |