コードでひどい問題に直面しています。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 クエリを直接実行したところ、問題なく実行されました。
何が悪いのかさっぱりわからない!ご支援いただきありがとうございます!