从Linq数据源捕获SQLExecption的Ho:
<asp:LinqDataSource ID="linq_tipo" runat="server"
ContextTypeName="Linq_Clinica_Veterinaria" EntityTypeName=""
TableName="tb_tipo_animals">
</asp:LinqDataSource>在Application_Error()引发之前,我能做什么呢?
发布于 2012-07-07 20:42:58
捕获异常,如下所示:
protected void linq_tipo_Updating(object sender,
LinqDataSourceUpdateEventArgs e) {
if (e.SQLException != null)
{
//Handle the exception
e.ExceptionHandled = true;//Set to true as you have handled the exception
} }类似地,您可以处理插入、删除、选择和其他事件。
https://stackoverflow.com/questions/11374882
复制相似问题