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
Trying to compile this code i get an error saying it doesnt know the variable conn.Code:public string response_message(string message) { SqlConnection conn; try { conn = new SqlConnection(sConn); } catch { } finally { conn.Close(); } }
So how can I use that connection in my finally block?
Thanx in advance,
Stephan





Reply With Quote