try putting the sqlCon.close() in the finally statement
SqlConnnection sqlCon = new SqlConnection("connnection string")
try
{
SqlCommand sqlCommand = new SqlCommand("command name", sqlCon);
// do your processings
your conditional statements
if (a < b)
return a;
else
return b;
}
finally
{
sqlCon.close()
sqlCon.Dispose()
}
the close will then be called no matter what..
HTH
HD
"JL" <jo********@mail.hotmail.com> wrote in message
news:eU**************@tk2msftngp13.phx.gbl...
Hi all,
I have a self defined function at following
Function testing()
if a < b then
return a
else
return b
end if
sqlCon.close()
Based on above function, does the system will excute the "sqlCon.close()"
statement after "end if"? or quit the function when excuted the "return"
statement.
Thanks a lot