6
Answers

how to get the message of SqlException error?

Hi

With this code below, i get the number of the SqlException error. But i want to see the full message instead of the error number.  For instance, instead of getting error number 207, i would like to get its equivalent message: "invalid column name". Is that possible?
try
{
..
}
catch (SqlException ex)
        {
         int a = ex.Number;
         ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Errornumber:' + '" + a + "');", true);
        }
Thanks

Answers (6)