我正在使用以下代码动态创建报告:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim mycon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" + My.Application.Info.DirectoryPath + "\mswd-rms.mdb")
Dim mycomm As New OleDbCommand("SELECT * FROM tbl_day_care", mycon)
Dim da As New OleDbDataAdapter()
da.SelectCommand = mycomm
Dim ds As New DataSet()
da.Fill(ds, "tbl_day_care")
Dim rpt As New CrystalReport1() 'The report you created.
rpt.SetDataSource(ds)
frmViewReport.CrystalReportViewer1.ReportSource = rpt
frmViewReport.Show()
End Sub
但是当报告加载时,报告是空白的。我从中获取记录的表不是空的。