On 6/6/07, Sean <[EMAIL PROTECTED]> wrote: > I have two types of transactions, one for read, one for write: > > ----------------------- > Write transaction: > > FbConnection conn = new FbConnection(_connectionString); > conn.Open(); > > txn = conn.BeginTransaction(FbTransactionOptions.Concurrency); > fbCommand.Transaction = txn; > retval = fbCommand.ExecuteNonQuery(); > txn.Commit(); > > conn.Close(); > conn.Dispose(); > > > Question: > 1. Does conn.Dispose() defeat the purpose of connection pool? Shall I just > Close the connection but not Dispose?
Just call Close. The connection will be placed into pool (if enabled). > 2. When BeginTransaction, what's the FbTransactionOptions I shall use? Will > FbTransactionOptions.Shared improve concurrency? It depends on your needs (what your application expect and what's doing). But TIL ReadCommited isn't bad for start. > ----------------------- > Read transaction. (No explicit transaction): > > FbConnection conn = new FbConnection(_connectionString); > conn.Open(); > > FbCommand fbCommand = conn.CreateCommand(); > fbCommand.CommandText = sqlCommand; > > // ... set fbCommand parameters > > FbDataAdapter dataAdapter = new FbDataAdapter(fbCommand); > retval = dataAdapter.Fill(ds, dsTable); > fbCommand.Dispose(); > > conn.Close(); > conn.Dispose(); > > Question: > 1. Shall I use transaction explicitly? Not neccessary. FbConnections creates own transaction internally, if nothing fails, it's commited. > Thank you! > Sean -- Jiri {x2} Cincura http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider