How does one use FbTransactionOptions / TransactionBehavior to implement a Wait?
I have found some info about using FbTransactionOptions / TransactionBehavior, but not enough details to implement.
string stCmd = "UPDATE " + stTableName + " SET " + liststFieldNamesNoKeyID[0] + " = @p0";
for (int iii = 1; iii < liststFieldNamesNoKeyID.Count(); iii++)
stCmd += ", " + liststFieldNamesNoKeyID[iii] + " = @p" + iii.ToString();
stCmd += " WHERE" + stFieldKeyID + "= @p" + liststFieldNamesNoKeyID.Count().ToString();
FbTransaction fbTransaction = fbConn.BeginTransaction();
new FbTransactionOptions()
{
TransactionBehavior = FbTransactionBehavior.Concurrency |
FbTransactionBehavior.Wait
};
using (FbCommand fbCmd = new FbCommand(stCmd, fbConn, fbTransaction)) {
for (int iii = 0; iii < liststFieldNamesNoKeyID.Count(); iii++) {
string stPlaceHolder = "@p" + (iii).ToString();
string stValue = liststNewValuesNoKeyID[iii];
fbCmd.Parameters.AddWithValue(stPlaceHolder, stValue);
}
int iKeyID = Convert.ToInt32(stKeyID);
fbCmd.Parameters.AddWithValue("@p" + liststFieldNamesNoKeyID.Count().ToString(), iKeyID);
fbCmd.ExecuteNonQuery();
fbTransaction.Commit();
In the above example, TransactionBehavior is not used. Rearranging causes the compiler to complain.
new FbTransactionOptions()
{
TransactionBehavior = FbTransactionBehavior.Concurrency |
FbTransactionBehavior.Wait
};
FbTransaction fbTransaction = fbConn.BeginTransaction(TransactionBehavior);
Also, how does one set the value of Wait?