return a value from Try - Catch block?
Posted on 2007-07-23
I am trying to secure my code by using try catch blocks where necessary. Here is a method I use:
public int doesExist()
conn.ConnectionString = strConn;
cmdCheck.Connection = conn;
cmdCheck.CommandText = ConfigurationSettings.AppSettings["spCheck"];
cmdCheck.CommandType = CommandType.StoredProcedure;
int iq = (int)cmdCheck.ExecuteScalar();
Whenever I want to put this piece between a try block, I get this error:
Error 5 The name 'iq' does not exist in the current context
How do I secure my code now?