is it possible to lock oracle 10g database table with C#/(ADO?).NET 2.0
- by matti
I have a table that contains a maximum value that needs to be get and set by multiple programs. How can I lock the table for a while when old value is got and new is updated in C#? In other words:
string sql = "lock table MaxValueTable in exclusive mode";
using (DbCommand cmd = cnctn.CreateCommand())
{
cmd.CommandText = sql;
// execute command somehow!!
}
maxValue = GetMaxValue();
SetMaxValue(maxValue + X);
sql = "lock table MaxValueTable in share mode";
using (DbCommand cmd = cnctn.CreateCommand())
{
cmd.CommandText = sql;
// execute command somehow!!
}
-BR: Matti