已经做好了的水晶报表文件,该如何在VB中调用呢? 如何实现打印和预览? 小弟对此不大熟悉,恳请高人指教,谢谢!!
解决方案 »
- 怎樣根據條件,自動發送Mail/Note
- vb写一导入数据程序,再进行导入时,Debug调试时能通过,但编译运行时就报错执行数据库出错(sybase 3621),大家帮帮忙
- 如何用循环的把RichTextBox一段落一个段落的把文本取出。
- 界面刷新问题
- 求VB数据库方面的英文文献3000-5000字
- 用户控件属性问题!(一百分又来了:))
- 急急急!!!98下运行通过2000下出现“连接由远程端重新设置”错误,高手请进!!
- 哪有水晶报表下载?
- 我想把程序一运行就放到右下角的任务栏上该如何实现阿,有谁知道?
- 语言编写
- 如何使用SetFileTime函数,解决马上给分!!!!
- 关于如何用api操作xp防火墙
Dim cnn1 As ADODB.Connection
Dim datcmd1 As ADODB.Command' *************************************************************
' Demonstrate the use of AddADOCommand by opening an ADO data command,
' adding the data source to the report, and then adding a field
' to the report that uses that data source.
'
Private Sub cmdADO_Click()
Dim fld As FieldObject
Dim strCnn As String
' Open the data connection
Set cnn1 = New ADODB.Connection
strCnn = "Provider=MSDASQL;Persist Security Info=False;Data Source=Xtreme Sample Database 9;Mode=Read"
cnn1.Open strCnn ' Create a new instance of an ADO command object
Set datcmd1 = New ADODB.Command
Set datcmd1.ActiveConnection = cnn1
datcmd1.CommandText = "Customer"
datcmd1.CommandType = adCmdTable ' Add the datasource to the report
m_Report.Database.AddADOCommand cnn1, datcmd1
' Add a new field object to the report and set the field object to use
' the new data source.
Set fld = m_Report.Section3.AddFieldObject("{ado.Customer Name}", 0, 0)
LoadReport
End Sub
---------------------------------------------------------------------------------------
按下按钮后提示 “未启用创建功能”问题是不是出在第一句 “Dim m_Report As New CrystalReport1” ? 该怎么改??
Dim rs As New ADODB.Recordset
Dim CApp As New CRAXDRT.Application
Dim CRpt As New CRAXDRT.Report
Dim i As Integer
conn.ConnectionString = ".1;PersiProvider=SQLOLEDBst Security Info=False;User ID=sa;Initial Catalog=aa;Data Source=das"
conn.Open
rs.Open "select * from ad ", conn, adOpenStatic, adLockOptimistic
Set CRpt = CApp.OpenReport("E:\Temp\text.rpt")
For i = 1 To CRpt.Database.Tables.Count
If CRpt.Database.Tables.Item(i).Name = "ado" Then
CRpt.Database.Tables(i).SetDataSource rs
End If
Next
CR.ReportSource = CRpt
CR.ViewReport
CR.Zoom 200
CR.Width = Me.ScaleWidth
CR.Height = Me.ScaleHeight