How to use finally()**SOLVED**
Hey folks, me again with a simple(at least I hope) problem. How do I use the finally clause! Heres what I am trying to do :
I open up a connection to a database, and want to close that conn in my finally block, heres my code
Code:
public string response_message(string message)
{
SqlConnection conn;
try
{
conn = new SqlConnection(sConn);
}
catch
{
}
finally
{
conn.Close();
}
}
Trying to compile this code i get an error saying it doesnt know the variable conn.
So how can I use that connection in my finally block?
Thanx in advance,
Stephan