这是我第一次使用水晶报表,但我不想使用向导,所以我尝试了这段代码
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Linq
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class view_fir_rpt_frm
Dim cn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("CRMSconn").ConnectionString)
Dim da As SqlDataAdapter
Dim ds As New DataSet
Dim cmd As SqlCommand
Private Sub view_fir_rpt_frm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cn.Open()
da = New SqlDataAdapter("select * from fir", cn)
da.Fill(ds, "fir")
MsgBox(ds.Tables("fir").Rows.Count)
cn.Close()
Dim cr As New CrystalReport1
"cr.SetDataSource(ds.tables("fir"))"
CrystalReportViewer1.ReportSource = cr
CrystalReportViewer1.Refresh()
End Sub
End Class
我在引用的行中收到错误,报告没有表格。那么谁能建议我应该在代码中做些什么改变?