J
Jake K
How do I access variables that are set within a try/catch block? The
following code produces a use of unassigned local variable error:
string varOne;
try
{
//access database here, select, datareader, etc...
varOne = dtr["column_name"].ToString();
}
catch (Exception e)
{
//something
}
MessageBox.Show(varOne);
I want to wrap the database connectivity, etc. in the try catch then use the
variable outside.
following code produces a use of unassigned local variable error:
string varOne;
try
{
//access database here, select, datareader, etc...
varOne = dtr["column_name"].ToString();
}
catch (Exception e)
{
//something
}
MessageBox.Show(varOne);
I want to wrap the database connectivity, etc. in the try catch then use the
variable outside.