[RESOLVED] [2.0] Error Ex.Message
Hi all
I am getting some error message at the bold part, error is
The type cougnt or throw must be derived from the system.exception
how to correct it.
Thanks
Code:
private Boolean ExecuteQuery(string queryString)
{
SqlCommand SqlCommand = new SqlCommand();
try
{
SqlCommand = ReturnCommand();
SqlCommand.CommandText = queryString;
SqlCommand.ExecuteNonQuery();
}
catch(Exception Ex)
{
throw Ex.Message; }//The type cougnt or throw must be derived from the system.exception
}
Re: [2.0] Error Ex.Message
Ok get the solution
vb Code:
catch(Exception Ex)
{
throw (Ex);
}
Re: [RESOLVED] [2.0] Error Ex.Message
Just note that there's absolutely no point catching an exception just to rethrow it again. If you aren't going to do anything in the catch block then it serves no purpose UNLESS you also have a finally block.