【问题标题】:Cancel SqlDataSource selecting rows when SelectCommand timeoutSelectCommand 超时时取消 SqlDataSource 选择行
【发布时间】:2015-11-05 17:16:53
【问题描述】:

SelectCommand超时时,如何取消选择SqlDataSource中的行?
我知道我可以设置CommandTimeout 属性,但我想处理错误并强制页面在SqlDataSource 超时时继续运行。

更多信息:
在我的页面中,ListView 使用 SqlDataSource 结果,但此结果不是我的主要内容,只是推荐主要内容的类似列表。

【问题讨论】:

    标签: asp.net sqldatasource selectcommand


    【解决方案1】:

    我找到了解决方案:Selecting 超时后,SqlDataSource Selected 事件开始运行。

    Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Selected
        If e.Exception is nothing=false andalso e.Exception.InnerException.ToString.ToLower.Contains("timed out") Then
            ListView1.Visible = False
            e.ExceptionHandled = True
        End If
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-31
      • 1970-01-01
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多