J
Jason H
Hi All,
This is my first post here and concerns using IBM's DB2 drivers. I don't
normally use DB2 so I don't have a lot of experience with it. Okay, enough of
the preamble....![Smile :) :)](/styles/default/custom/smilies/smile.gif)
My question is.....
If I use the iDB2Connection then close the form it's held in I get an
"ObectDisposedException" thrown. Example code below....
private void button1_Click(object sender, EventArgs e)
{
string cs = Properties.Settings.Default.CS.ToString();
iDB2Connection cn = new iDB2Connection(cs);
//using(iDB2Connection cn = new iDB2Connection(cs))
//{
//}
cn.Dispose();
}
I've tried various things to get round this problem, removing more and more
lines until I get to this. The object can be used with the database. You'll
not that the above example does not even try to open a DB connection. It
appears enough that the object be created and disposed. Note also that the
exception doesn't get thrown until the form is closed. It doesn't matter how
long you wait.
I'd like to know how I stop the exception from being thrown. Failing that
what is the best way to trap the exception on a closed form?
Thanks
Jason.
This is my first post here and concerns using IBM's DB2 drivers. I don't
normally use DB2 so I don't have a lot of experience with it. Okay, enough of
the preamble....
![Smile :) :)](/styles/default/custom/smilies/smile.gif)
My question is.....
If I use the iDB2Connection then close the form it's held in I get an
"ObectDisposedException" thrown. Example code below....
private void button1_Click(object sender, EventArgs e)
{
string cs = Properties.Settings.Default.CS.ToString();
iDB2Connection cn = new iDB2Connection(cs);
//using(iDB2Connection cn = new iDB2Connection(cs))
//{
//}
cn.Dispose();
}
I've tried various things to get round this problem, removing more and more
lines until I get to this. The object can be used with the database. You'll
not that the above example does not even try to open a DB connection. It
appears enough that the object be created and disposed. Note also that the
exception doesn't get thrown until the form is closed. It doesn't matter how
long you wait.
I'd like to know how I stop the exception from being thrown. Failing that
what is the best way to trap the exception on a closed form?
Thanks
Jason.