我的代码面临一个可怕的问题。当我执行 DataBind 方法时,页面加载并加载,几乎 5 分钟后 GridView 被填充。这不是 SQL 查询问题!
我使用 Visual Studio 调试器进行了测试,代码在 DataBind() 上停止
Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) /* This is not the correct code but at the end, the result will be same as below */ Dim feedback As String = "positive" Dim date As String = "2013" bindDataShowDetails(feedback, date) // <----- I call this method ( below ) End Sub
Protected Sub bindDataShowDetails(ByVal feedback As String, ByVal Data As String())
feedbackGlobal = feedback
Dim strSql As String = ""
strSql = " select "
strSql += " feedback, zendesk_ticket_id,feedback_text as Comment, date_ins as Ticket_date, date_feedback as Feedback_date, comment_review, review_status "
strSql += " from feedbacks_support "
strSql += " where "
strSql += " feedback = '" & feedback & "'" // <---- 'positive'
strSql += " and YEAR(date_feedback) = " & Date // <---- '2013'
Dim myreader As SqlDataReader = admin2.ExecReader(strSql) // <--- Class 'admin2' calls the method (ExecReader) thats executes the SQL query and return the result.
GridView1.DataSource = myreader
GridView1.DataBind() <----------- Problem is here!!!
Me.ModalPopupExtender1.Show()
End Sub
我在 SQL Server 中直接运行 SQL 查询,它运行良好!
我真的不知道怎么了!非常感谢您的支持!