Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not use Transaction with MS Access DB #454

Closed
hpposch opened this issue May 4, 2018 · 3 comments
Closed

Can not use Transaction with MS Access DB #454

hpposch opened this issue May 4, 2018 · 3 comments

Comments

@hpposch
Copy link

hpposch commented May 4, 2018

I have a MS Access database and i use PetaPoco with the OleDb to read and write data to that database.
Read-Write works perfectly, but when i try to use a transaction to write nested data (Header entry with multiple child entries) i get the following error:
The OleDB transaction has been completed, it is not longer usable

This happens always when i call Complete or CompleteTransaction.
I tried all differnet examples from here: https://github.com/CollaboratingPlatypus/PetaPoco/wiki/Transactions

I hope someone has got an idea how to solve this issue.

Thanks in advance :)

@hpposch
Copy link
Author

hpposch commented May 4, 2018

Also the data, i want to write inside the transaction, is written directly to the database.
It does not matter if i call AbortTransaction.

@pleb
Copy link
Member

pleb commented May 4, 2018 via email

@asherber
Copy link
Collaborator

The following basic use of a transaction with Access works for me. If you have a small reproducible example of a transaction not working, please post it. Please include the table structure if that seems to be part of the issue.

var config = DatabaseConfiguration.Build()
    .UsingConnectionString(@"...")
    .UsingProvider<MsAccessDbDatabaseProvider>();
    
using (var db = new Database(config))
using (var trans = db.GetTransaction())
{
    var poco = new Table1() { Field1 = "Thing2" };
    db.Insert(poco);
    trans.Complete();
}

@pleb pleb closed this as completed Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants