Hi,
How do you deal with cases when database update (SQL Server) fails (e.g. constraints)? Here is a code from the DAL class that updates the database (this is not my code; I borrowed it from a blog of a famous person here <g>):
protected void SaveTable(DataTable Table, string SaveProc)
{
foreach (DataRow row in Table.Rows)
{
this.SetAllParameters(row);
this.ExecuteCommand(SaveProc);
}
}
protected void ExecuteCommand(string StoredProcName)
{
try
{
this.oCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
}
What I would like is to be able to return the error message back to the UI layer to be displayed.
TIA for any suggestions.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham