我在VB中引用水晶报表控件写了如下代码:
Dim CryApp As New CRAXDDRT.Application
Dim report As CRAXDDRT.report
Dim strcnn As String
Set report = CryApp.OpenReport(App.Path & "\wat-mon-report.rpt")
Set Connection1 = New ADODB.Connection
Set rscomwind = New ADODB.Recordset
strcnn = "Provider=SQLOLEDB;Persist Security Info=True;User ID=sa;password=;Initial Catalog=tjport;Data Source=amourette"
Connection1.Open strcnn
rscomwind.Open "select * from twater where tmonth='" & Combo1.Text & "'and boweiname='" & Combo2.Text & "'and torder='" & Combo5.Text & "'and tyear between'" & Combo3.Text & "'and '" & Combo4.Text & "'", Connection1, adOpenDynamic, adLockBatchOptimistic
report.Database.SetDataSource rscomwind
report.DiscardSavedData
Screen.MousePointer = vbHourglass
CRViewer91.ReportSource = report
CRViewer91.Refresh
CRViewer91.ViewReport
Screen.MousePointer = vbDefault运行时指向第一行报错“用户定义类型未定义”,是何缘故???
Dim CryApp As New CRAXDDRT.Application
Dim report As CRAXDDRT.report
Dim strcnn As String
Set report = CryApp.OpenReport(App.Path & "\wat-mon-report.rpt")
Set Connection1 = New ADODB.Connection
Set rscomwind = New ADODB.Recordset
strcnn = "Provider=SQLOLEDB;Persist Security Info=True;User ID=sa;password=;Initial Catalog=tjport;Data Source=amourette"
Connection1.Open strcnn
rscomwind.Open "select * from twater where tmonth='" & Combo1.Text & "'and boweiname='" & Combo2.Text & "'and torder='" & Combo5.Text & "'and tyear between'" & Combo3.Text & "'and '" & Combo4.Text & "'", Connection1, adOpenDynamic, adLockBatchOptimistic
report.Database.SetDataSource rscomwind
report.DiscardSavedData
Screen.MousePointer = vbHourglass
CRViewer91.ReportSource = report
CRViewer91.Refresh
CRViewer91.ViewReport
Screen.MousePointer = vbDefault运行时指向第一行报错“用户定义类型未定义”,是何缘故???
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货