|Subject||Re: [firebird-support] Object in use... wtf???|
Den 2013-11-25 23:50 skrev Alan McDonald såhär:
Scenario, in a single connection I do this:Thank you! Umm... I did find it difficult to determine (docs?) what the various transaction options in the .Net provider really mean for FB, but these are the flags I use for all transactions:
1. Start transaction.
2. Create table.
4. Start transaction.
5. Insert rows.
6. Select using join with other tables.
8. Start transaction.
9. Drop table.
---> ERROR: Object is in use.
The select is done using this C# construct, which should close and dispose of the query:
using (FbDataReader rd = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow))
for (int colnum = 0; colnum < rd.FieldCount; colnum++)
string colname = rd.GetName(colnum);
int count = rd.GetInt32(colnum);
if (count > 0)
result.Counts[colname] = count;
The FbCommand cmd has default settings except this:
cmd.CommandType = System.Data.CommandType.Text;
Anything wrong with these options etc?
Tried to add rd.Close after the for loop, but it didn't help. What did help was to close the connection and reopen it between the select commit and the starting the transaction for the drop.
But why is that necessary?
-- -------------------------------------- Kjell Rilbe DataDIA AB E-post: kjell@... Telefon: 08-761 06 55 Mobil: 0733-44 24 64