1. You create a Crystal Report with the Active Data Driver and pass the recordset in VB with .SetDataSource before viewing the report.
2. V8.5. There are 3 different flavors in V8. You want the "Developer Edition" to use with VB, ASP or other programming languages. The upgrade version is somewhere between $225 and $250 depending upon where you buy it.
Dear balves:
I have create a Crystal Report "CrystalReport6.rpt" with the Active Data Driver, but the report data couldn't be shown , the SetDataSource method seems doesn't work, could you kindly help me?
my system: win2000, crystal report 7.0, vb 6.0
thanks!
bob
Private Sub Command1_Click()
Dim OleDbConnection1 As New ADODB.Connection
Dim Recordset1 As New ADODB.Recordset
Dim Recordset2 As New ADODB.Recordset
Dim app1 As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Set Report = app1.OpenReport("D:\tmp\CrystalReport6.rpt"
OleDbConnection1.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\tmp\LocalAccess.mdb"
Recordset1.Open "SELECT product_id,brand_name,product_name FROM product where product_id>25 and product_id<30", OleDbConnection1, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly
Report.DiscardSavedData
Report.Database.Tables(1).SetDataSource Recordset1
' Report.Database.Tables(1).SetPrivateData 3, Recordset1
' Report.Database.Tables.Item(1).SetPrivateData 3, Recordset1
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Thanks, balves.
Indeed the SetPrivateData and SetDataSource both are correct. Now I found the problem is i used a worng datasource type. When adding database to report, we must select according these option: add database to report --> active data --> ODBC(ADO), not others.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.