fbtransactionにオプションを設定します
-
26-12-2019 - |
質問
このオプションをfbtransaction
に設定できる方法write
nowait
rec_version
read_committed
.
私のコードでは、挿入/更新SQL文を実行する:
FbConnectionStringBuilder fbConnStr = new FbConnectionStringBuilder();
using (FbConnection fbConn = new FbConnection(fbConnStr))
{
fbConn.Open();
using (FbTransaction fbTran = fbConn.BeginTransaction())
{
using (FbCommand fbCmd = new FbCommand("insert into TEST values (1)", fbConn, fbTran)
{
fbCmd.CommandType = CommandType.Text;
fbCmd.ExecuteNonQuery();
fbCmd.Transaction.Commit();
}
}
fbConn.Close();
}
. 解決
FbTransactionOptions
を使用できます。
FbTransaction transaction = Connection.BeginTransaction(
FbTransactionOptions.ReadCommitted |
FbTransactionOptions.Write|
FbTransactionOptions.RecVersion|
FbTransactionOptions.NoWait |
);
.
IsolationLevel
:
-
IsolationLevel.ReadUncommitted
-
IsolationLevel.ReadCommitted
-
IsolationLevel.RepeatableRead
-
IsolationLevel.Serializable
あなたはできる:
FbTransaction transaction = Connection.BeginTransaction( IsolationLevel.Serializable );
. 所属していません StackOverflow