Problem with BeginTrans / CommitTrans / RollbackTrans
Hi,
i have some problem using transactions (i am using adox). This works great. But locks-up tables. After a succussfull CommitTrans, even after rebooting the system, i cannot
1. deleted the table
2. Create a new field
(through code of course).
i get the message
"The database engine couldn't lock table 'activity' because it's already in use by another person or process."
If i comment all the transaction code, i can do everything!.
please help!
thanks
Sharath
Re: Problem with BeginTrans / CommitTrans / RollbackTrans
Beware: you cannot have nested transactions (was this the case?)
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood,
Bruno Paris and all the other wonderful people who made and make Codeguru
a great place.
Come back soon, you Gurus.
The Rater
Re: Problem with BeginTrans / CommitTrans / RollbackTrans
Thanks. but i dont think so.
The code flow goes something like this.
(My connection object is a modular object in the class.BeginTrans and RollbackTrans are in two precedures!)
CreateOrOpen(strDatabase file), (which has mconAdoConnection.BeginTrans)
Trow up a progress bar with a cancel button
CreateTables (with basic fields)
Iterate through the collection of classes
Get each object in the collection
Iterate through the properties, same time check for the field in the table.
'This class is user customisable and user can add his own properties into this class)
Create the field if it does not exists!
Update Table
mconAdoConnection.CommitTrans
Meanwhile, i also check of the user has cancelled, if so i will call
mconAdoConnection.RollbackTrans
And finaly i have
mconAdoConnection.Close
Thanks a lot,
Sharath
Re: Problem with BeginTrans / CommitTrans / RollbackTrans
Are you catching all errors i.e. is the begintrans ALWAYS matched with a commit or rollback.