水晶报表4.6的使用示例

王朝c#·作者佚名  2006-12-17
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航