"Connection must be open for this operation"
Hey,
I use PetaPoco 5.1.306 together in an ASP.Net environment running .NET 5. Every few inserts/updates/selects the following happens: I get an error from Oracle.ManagedDataAccess:
System.InvalidOperationException: Connection must be open for this operation
at Oracle.ManagedDataAccess.Client.OracleCommand.ValidateStatePriorToExecution()
at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
at PetaPoco.Database.ExecuteInsert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
at PetaPoco.Database.Insert(Object poco)
When I check the status of the DB connection before the insert, it says "Open".
What could be the reason for this?
Still have this problem :/
So if you check myDb.Connection.State, it says Open? At a glance, that implies that this is some issue with the Oracle provider, not with PP. PP thinks the connection is open, it sends the commend to the Oracle provider, and then the provider says, "Whoops, not open" and throws an exception.
How are you creating your Database object? Are you passing in your own connection, or are you using a connection string?