[stackoverflow] [progress Openedge Abl] Odbcconnection Transaction Check Before New...

Status
Not open for further replies.
W

Wiktor

Guest
I am connection to Progress Database through ODBCConnection class.

How Can I check if there is any open transactions ( record is locked ) on record before I start new one transaction?

My function:

Task.Run(() =>
{
using (OdbcConnection con = new OdbcConnection("DSN=MY_DSN;UID=root;PWD=qweasd"))
{
OdbcCommand command = new OdbcCommand();
OdbcTransaction transaction = null;

command.Connection = con;

try
{
con.Open();
AppendLine("Connection...");

while (con.State != ConnectionState.Open)
{
AppendLine(".");
Thread.Sleep(10);
}
AppendLine("");
AppendLine("Connected");


// THIS IS PLACE WHERE I WANT TO CHECK IF RECORD IS LOCKED


transaction = con.BeginTransaction();

command.Connection = con;
command.Transaction = transaction;

command.CommandText = " UPDATE pub.ad_mstr SET ad_line1 = 'Line button3' where ad_mstr.ad_addr = '01010101' ";

command.ExecuteNonQuery();

AppendLine("30 seconds dreams");

for (int i = 0; i < 30; i++)
{
Append(".");

Thread.Sleep(1000);
}


transaction.Commit();
AppendLine("Commited");

}
catch (Exception exc)
{
AppendLine( exc.Data + " " + exc.Source + " " + exc.Message);

try
{

}
catch
{

}
}

}
//_startedTransaction1 = true;
}); /* Task.Run ( () => */


Thank You for any help.

Continue reading...
 
Status
Not open for further replies.
Top