vb6中如何调用水晶报表9的报表

lyxhappy 2003-09-04 12:04:54
在vb6中如何调用水晶报表9做的报表
...全文
76 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fazhy 2003-09-12
  • 打赏
  • 举报
回复
up
lihonggen0 2003-09-05
  • 打赏
  • 举报
回复
Dim CryApp As New CRAXDDRT.Application
Dim Report As CRAXDDRT.Report

Dim strCnn As String
Set Report = CryApp.OpenReport(App.Path & "\report2.rpt")

Dim cnn1 As New ADODB.Connection
Dim adoRS As New ADODB.Recordset

strCnn = "Provider=sqloledb;Data Source=abrams;Initial Catalog=salestesttmp;User Id=sa;Password=test;"
cnn1.Open strCnn

adoRS.Open "select top 10 * from answers", cnn1, adOpenDynamic, adLockBatchOptimistic
Report.Database.SetDataSource adoRS

Screen.MousePointer = vbHourglass
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
hsanzhang 2003-09-04
  • 打赏
  • 举报
回复
必須引用ado及crystal report9 activex designer design time library(internal)
還必須使用控件 crystal report viewer contral
priver sub form_load()
dim strsql as string
Dim i As Integer
dim capp As New CRAXDRT.Application
dim carp As New CRAXDRT.Report
dim cn as new adodb.connection
dim rs as new adodb.recordset
If cn.State = adStateOpen Then cn.Close
With cn
.Provider = "sqloledb"
.ConnectionString = "data source=dd;initial catalog=dfd;user id=sa;password=aaa"
.Open
End With
strsql="select * from tabname"
If rs.State = adStateOpen Then rs.Close
With rs
.ActiveConnection = cn
.CursorLocation = adUseClient
.Open strsql, cn, adOpenDynamic, adLockOptimistic
End With

Set carp = capp.OpenReport("E:\reports\finisher.rpt")
For i = 1 To carp.Database.Tables.Count
If carp.Database.Tables.Item(i).Name = "ado" Then
carp.Database.Tables(i).SetDataSource rs
End If
Next

crviw.ReportSource = carp
crviw.ViewReport
crviw.Zoom 100
end sub

809

社区成员

发帖
与我相关
我的任务
社区描述
VB 多媒体
社区管理员
  • 多媒体
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧