Skip to Content
0
Former Member
Aug 04, 2008 at 07:00 AM

No records shown in report ?

227 Views

I have created a crystal report using ado.net dataset ("OleDB to SQL server database") and load it to a crystal report viewer in testreport2.aspx. No errors when run but no records where shown.

There is no problem with the data table return from GeneralProduct class as the DropDownList1 contains 30 item and textbox1 displays a total of 30 records from data table return.

=================================================

Imports CrystalDecisions.CrystalReports.Engine

Partial Class testreport2

Inherits System.Web.UI.Page

Private oRpt As ReportDocument

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

CrystalReportViewer1.EnableDatabaseLogonPrompt = False

oRpt = New ReportDocument

oRpt.Load(Server.MapPath("CrystalReport2.rpt"))

Dim _GeneralProduct As New GeneralProduct

_GeneralProduct.GetGeneralProductDataTable()

TextBox1.Text = "Record Count [" & CStr(_GeneralProduct.RecordsCount) & "]"

oRpt.SetDataSource(_GeneralProduct.oDataTable)

CrystalReportViewer1.ReportSource = oRpt

CrystalReportViewer1.DataBind()

CrystalReportViewer1.RefreshReport()

dd.DataTextField = "ProductID"

dd.DataValueField = "ProductID"

dd.DataSource = _GeneralProduct.oDataTable

dd.DataBind()

_GeneralProduct = Nothing

End If

If IsPostBack Then

oRpt = Session.Item("oReport")

CrystalReportViewer1.ReportSource = oRpt

End If

End Sub

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload

Session.Add("oReport", oRpt)

End Sub

End Class

=================================================

Someone please assist....

Edited by: Kong Meng Chang on Aug 4, 2008 3:13 PM