R
rbDeveloper
In the code below, I'm setting a watch on the variable dbCon. When I expand
the watch on dbCon, one of the visible items under dbCon is "ServerVersion."
When the dbCon.Close() executes, I see the following:
dbCon.ServerVersion threw an expection of type
'System.InvalidOperationException'
....and the details...
Operation is not valid due to the current state of the object.
I'd rather not throw exceptions. Any ideas what I need to do before closing
to avoid all this?
Thanks...
DbConnection dbCon = null;
dbCon = db.CreateConnection();
dbCon.ConnectionString = DBConstants.ConnectionString(dbCon.ConnectionString);
dbCon.Open();
adpt.SelectCommand = dbCmd;
adpt.SelectCommand.Connection = dbCon;
adpt.Fill(result);
dbCon.Close();
the watch on dbCon, one of the visible items under dbCon is "ServerVersion."
When the dbCon.Close() executes, I see the following:
dbCon.ServerVersion threw an expection of type
'System.InvalidOperationException'
....and the details...
Operation is not valid due to the current state of the object.
I'd rather not throw exceptions. Any ideas what I need to do before closing
to avoid all this?
Thanks...
DbConnection dbCon = null;
dbCon = db.CreateConnection();
dbCon.ConnectionString = DBConstants.ConnectionString(dbCon.ConnectionString);
dbCon.Open();
adpt.SelectCommand = dbCmd;
adpt.SelectCommand.Connection = dbCon;
adpt.Fill(result);
dbCon.Close();