发新话题
打印

[数据库] 水晶报表,紧急求救!!!

水晶报表,紧急求救!!!

以下程序运行后无错误,只是报表中不显示任何数据,明天要交论文了,请各位大虾帮帮忙!!

Dim m_Report As New CrystalReport1 '(这个CrystalReport1是你建立的报表的名称)
Dim m_Connection As ADODB.Connection '(建立一个ADO连接)
Dim adoRS As ADODB.Recordset
Private Sub Form_Load()
Dim SQL As String
Dim strConnect As String

' Create and bind the ADO Recordset object
Set m_Connection = New ADODB.Connection
Set adoRS = New ADODB.Recordset

' Open the connection
m_Connection.Open sqlconection '数据库连接公共字符串
SQL = "select * from [" & lesson.ss & "]"
adoRS.Open SQL, m_Connection, adOpenDynamic, adLockBatchOptimistic
m_Report.Database.SetDataSource adoRS '(动态设置报表数据源)
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = m_Report
CRViewer1.ViewReport '(显示报表)
Screen.MousePointer = vbDefault

End Sub

TOP

试了,还是什么都不显示,是不是报表的字段没定义好也会影响阿,可是我定义的字段名都是显示乱码

TOP

发新话题