I am getting a "Query Engine Error" when showing up my report in CRViewer. Why is this happening? Any solution or suggestion so that I can solve the problem? I am trying to figure out this problem for about 3 days now. Other report works well with dataset being passed using plain "SELECT * FROM TABLENAME where ....". but in this case i am using a stored procedure to return a result in a query in a dataset. Please help and thank you in advance.
Private Sub PrintReport()
Dim crViewerFrm As New crptViews
Dim oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim daReport As SqlClient.SqlDataAdapter
Dim dsReport As New DataSet
If (Len(Trim(txtPaymentNo.Text)) <> 0) And IsNumeric(txtPaymentNo.Text) Then
'--- get the records
strSQL = "sp__pcs_PrintSelectedPayment '" & Trim(CoCode) & "'," & CInt(txtPaymentNo.Text)
daReport = New SqlClient.SqlDataAdapter(strSQL, dbcnn)
dsReport.Clear()
daReport.Fill(dsReport, strSQL)
oRpt = New CrystalDecisions.CrystalReports.Engine.ReportDocument
oRpt.Load("D:\\AMJ\\PCS.Net\\ProjectCostingSystem\\crpt\\cPayment.rpt")
If dsReport.Tables(0).Rows.Count <> 0 Then
oRpt.Database.Tables(0).SetDataSource(dsReport)
crViewerFrm.CrystalReportViewer1.ReportSource = oRpt
crViewerFrm.Show() <--- ERROR IN THIS LINE
Else
MsgBox("No record to print!", MsgBoxStyle.Exclamation, msgboxTitle)
End If
End If
End Sub
Private Sub PrintReport()
Dim crViewerFrm As New crptViews
Dim oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim daReport As SqlClient.SqlDataAdapter
Dim dsReport As New DataSet
If (Len(Trim(txtPaymentNo.Text)) <> 0) And IsNumeric(txtPaymentNo.Text) Then
'--- get the records
strSQL = "sp__pcs_PrintSelectedPayment '" & Trim(CoCode) & "'," & CInt(txtPaymentNo.Text)
daReport = New SqlClient.SqlDataAdapter(strSQL, dbcnn)
dsReport.Clear()
daReport.Fill(dsReport, strSQL)
oRpt = New CrystalDecisions.CrystalReports.Engine.ReportDocument
oRpt.Load("D:\\AMJ\\PCS.Net\\ProjectCostingSystem\\crpt\\cPayment.rpt")
If dsReport.Tables(0).Rows.Count <> 0 Then
oRpt.Database.Tables(0).SetDataSource(dsReport)
crViewerFrm.CrystalReportViewer1.ReportSource = oRpt
crViewerFrm.Show() <--- ERROR IN THIS LINE
Else
MsgBox("No record to print!", MsgBoxStyle.Exclamation, msgboxTitle)
End If
End If
End Sub