数据库抛出异常导致 FOREIGN KEY 冲突。
Jack Lee
问问题
2700 次
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
如果这对使用网格视图更新方法没有帮助
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 回答