程序运行后,水晶报表里是空的,为什么?
运行后,水晶报表里是空的,为什么?Dim oApp As New CRAXDRT.Application
Dim oRpt As CRAXDRT.Report
Dim reportName As String
Dim rs As ADODB.Recordset
Dim SQL As String
Screen.MousePointer = vbHourglass
reportName = "\report1.rpt" '定义要引用的rpt文件
Set oRpt = oApp.OpenReport(App.path & reportName, 1)
SQL = "select stuId,stuName from student"
Set rs = New ADODB.Recordset
rs.Open SQL, adoConnection, adOpenKeyset, adLockReadOnly
MsgBox rs.RecordCount ''''' 提示=4
MsgBox rs.Fields(1).Value ''''' 提示ff
MsgBox rs.Fields(1).Value ''''' 提示ff
oRpt.Database.SetDataSource rs '连接水晶报表和数据源
oRpt.ReadRecords
CRViewer91.ReportSource = oRpt '启用水晶报表的预览功能
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
补充:VB , 数据库(包含打印,安装,报表)