Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports 4 with VB6 and ADO

Status
Not open for further replies.

moben

IS-IT--Management
Feb 5, 2002
116
GB
Question,

1.How does one pass contents of a ADO recordset created at runtime to a Crystal report ?

2.What is the latest version of Crystal Reports, and can I move my exisitng Crystal reports to the new version without any major modifications.

Moben
 
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 &quot;SELECT product_id,brand_name,product_name FROM product where product_id>25 and product_id<30&quot;, 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


End Sub
 
I haven't used .SetDataSource against a particular table. I use it against the Report object, as in:

Report.Database.SetDataSource Recordset1, 3

You need the &quot;3&quot; as the second parameter.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top