GridView搭配SqlDaraSource 對資料庫動作產生exception

對資料庫進行動作時,產生的錯誤再動作完之後傳回
所以插入錯誤的錯誤就會在Inserted 、刪除就在Deledted,以此類推
ex:
 protected void SqlDataSources1_Inserted1(object sender, SqlDataSourceStatusEventArgs e)
    {
        //設定產生錯誤由設計者處理
        e.ExceptionHandled = true;
        if (e.Exception != null)
        {
            Response.Write("錯誤訊息");
        }
    }

留言

這個網誌中的熱門文章

SQL SEVER備份與還原遭遇問題

DropDownList連動