Imposta le opzioni su FbTransaction
-
26-12-2019 - |
Domanda
Come posso impostare queste opzioni su FbTransaction
write
nowait
rec_version
read_committed
.
Nel mio codice per eseguire Inserisci / aggiorna le istruzioni 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();
}
. Soluzione
È possibile utilizzare FbTransactionOptions
:
FbTransaction transaction = Connection.BeginTransaction(
FbTransactionOptions.ReadCommitted |
FbTransactionOptions.Write|
FbTransactionOptions.RecVersion|
FbTransactionOptions.NoWait |
);
.
Guarda anche a IsolationLevel
:
- .
-
IsolationLevel.ReadUncommitted
-
IsolationLevel.ReadCommitted
-
IsolationLevel.RepeatableRead
-
IsolationLevel.Serializable
Potresti fare:
FbTransaction transaction = Connection.BeginTransaction( IsolationLevel.Serializable );
. Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow