Hi,
I am trying to create a dialog box that executes a Stored Procedure using OraDirect and has a Cancel button allowing the user to cancel the operation. I am able to launch a new thread that is supposed to execute the stored procedure but my UI thread freezes. If I do anything else that is time consuming (such as a very big loop) in that new thread I am able to successfully push the Cancel button and kill it. However, as soon as I call executeNonQuery on a OracleCommand object the whole app freezes.
Help please,
Stoyan
// This is how I start the thread
public delegate void ProcessFunction();
public MessageWindow(ProcessFunction func)
{
InitializeComponent();
Thread thread = new Thread(new ThreadStart(func));
thread.Start();
}
// This is how I call the MessageWindow class
new MessageWindow(CreateBackup).ShowDialog(this);
// And this is the function that is supposed to make the SP call
public void CreateBackup()
{
/* doing something large as long as it is not SP call works
for (long i = 0; i < 10000000000; i++)
{
string t = "";
}*/
using (OracleCommand cmd = new OracleCommand("BackupManager.Backup", ConnectionManager.Instance.Connection))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
}
}