我正在使用以下代码动态创建报告:
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
但是,当报告加载时,报告为空白。我从中获取记录的表格不是空的。
答案 0 :(得分:2)
按照以下步骤操作,希望有所帮助:)
链接:http://vb.net-informations.com/crystal-report/vb.net_crystal_report_step_by_step.htm