开发者

Handling asp.net datasource exceptions

I have a datasource that uses a business logic object for the select event. How can I catch an exception that occurs in the开发者_如何学JAVA business logic layer and pass it to my presentation layer to display to the user in a label?


You can catch datasource exceptions like this:

protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
{
    if (e.Exception != null)
    {
        // do something
        e.ExceptionHandled = true;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜