水晶报表4.6的使用示例

Private Sub Command1_Click(Index As Integer)
With cr1    'cr1为报表控件
.PrinterDriver = Printer.DeviceName
.DiscardSavedData = True
'-------------------------------------------------
'连接方式一
.Connect = "DSN = drugdb;UID =sa;PWD =;"
'连接方式二
.Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=evaluate;Data Source=SAMUNCLE"]
'连接方式三
Dim adocon As ADODB.Connection
Set adocon = New ADODB.Connection
adocon.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=drugdb;Data Source=SAMUNCLE"
adocon.ConnectionTimeout = 120
adocon.Open
'-------------------------------------------------
.Destination = crptToWindow     '预览
.ReportSource = crptReport       
.WindowHeight = Screen.Height
.WindowWidth = Screen.Width
.ReportFileName = App.Path + "/crystaltest47.rpt"
.WindowTitle = "标题"
.WindowState = crptMaximized    '窗口最大化
.WindowLeft = 0
.WindowTop = 0

.Formulas(0) = ""
.Formulas(1) = ""
.Formulas(0) = "这是第一个参数!"
.Formulas(1) = "这是第二个参数!" & Chr(13) & Chr(10) & "我回行了"
.FetchSelectionFormula
.Action = 1
End With

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值