I have a class with this method:
public static DataTable getHeader(DALheader header)
{
string sql = string.Format("EXECUTE getHeader @headerID = {0}", header.headerID);
SqlDataAdapter headerAdapter = new SqlDataAdapter(sql, eformConnection);
DataTable headerTable = new DataTable();
try
{
headerAdapter.Fill(headerTable);
return headerTable;
}
catch(Exception ex)
{
throw ex;
}
}
on the code behind of an ASPX, I call this method. if i throw ex, you see the asp.net error in the browser. I want to keep them on the page and display the error. I put the method call in a try catch but that didn't do it, I can't return ex because I have to return a DataTable if I return anything. I'm not sure how to get the error message back to the page.