0
Reply

Return error message from .cs class

George Phillipson

George Phillipson

May 3 2006 10:47 AM
1.9k
Hi
Can anyone help with this problem, I have the following snippet of code:
try
            {
                dbCon.Open();
                cmd.ExecuteNonQuery();
                return (int)cmd.Parameters["@GetOrderNumber"].Value;

            }
            catch (SqlException)
            {
                Need to catch error here and return message to index.aspx page
            }
            finally
            {
                dbCon.Close();
            }

The code is taken from the DATABASE.CS file with namespace DateBaseConnection, how can I catch the error if any and display a friendly error message on the index page saying: "sorry an error has occured and we cannot process your request"
The error message will be in a literal control called "litReturnError"

I'm new to learning about 3 tier web application and this problem has me stuck.
Any help would be appreciated
George