4

データベースによって例外がスローされ、FOREIGN KEY によって競合が発生します。

4

3 に答える 3

4

ObjectDataSource の eventargs を見てください。更新の成功/エラーを照会できる e.Exception & e.Results があるはずです。

protected void MyOds_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
    if (e.Exception != null)
    {
        // handle exception here.
    }
}
于 2009-05-14T02:23:03.207 に答える
3

例外を再スローしないように ObjectDataSource に指示するには、ExceptionHandledフラグを True に設定する必要があります。

protected void MyOds_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
    if (e.Exception != null)
    {

        //this tells the ObjectDatasource : It's ok, i'm taking care of this
        //and don't rethrow it.
        e.ExceptionHandled = true

        // handle exception here (log/display to user etc ...)
    }
}

これがお役に立てば幸いです。

マニトラ。

于 2009-11-27T11:06:45.100 に答える
0

これが役に立たない場合は、グリッド ビューの update メソッドを使用してください

If Not e.Exception Is Nothing Then
    e.KeepInEditMode = True
    e.ExceptionHandled = True
    msg("error .", "a", Me.GetType(), ClientScript)
End If
于 2011-02-01T02:09:25.940 に答える