CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Location
    Bangalore, INDIA
    Posts
    70

    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



  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    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
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Aug 1999
    Location
    Bangalore, INDIA
    Posts
    70

    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



  4. #4
    Join Date
    Aug 2000
    Location
    Namibia
    Posts
    139

    Re: Problem with BeginTrans / CommitTrans / RollbackTrans

    Are you catching all errors i.e. is the begintrans ALWAYS matched with a commit or rollback.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured