Print Page | Close Window

How to Pass recordset from vb6 application

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16670
Printed Date: 21 Apr 2025 at 12:14pm


Topic: How to Pass recordset from vb6 application
Posted By: huren
Subject: How to Pass recordset from vb6 application
Date Posted: 04 Jun 2012 at 7:32pm
How to Pass Recordset From Vb6 Application to Crystal Report 10 ?

I have written the following code for passing recordset . still no luck. I am getting an error of "table not found?"

Following is the code

Dim m_Report as new CrystalReportSmple

Private sub Form1()
Dim strconn As String
Dim rsCompany As ADODB.Recordset
Screen.MousePointer = vbHourglass

Set m_Connection = New ADODB.Connection
Set rsCompany = New ADODB.Recordset
''''''''''''''Connection Sting'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strconn = "DRIVER={MySQL ODBC 3.51 Driver};user=test;password=test;server=localhost;Database=TestDatabase;option=16427"
m_Connection.Open strconn
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Query = "SELECT FirstName,LastName,Address,City FROM tblcustomers "
rsCompany.Open Query, m_Connection, adOpenStatic, adLockOptimistic

''''''''''''''''''''''''''''''''''''''''''''''Getting Error at this line'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

m_Report.Database.SetDataSource rsCompany   

''''''''''''''''''''''''''''''''''''''''''''''Mapping to unbound fields''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    With m_Report
        .UnboundString1.SetUnboundFieldSource "{tblcustomers.FirstName}"
        .UnboundString2.SetUnboundFieldSource "{tblcustomers.LastName}"
    End With
 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    ' View the report
    CRViewer1.ReportSource = m_Report
    CRViewer1.ViewReport
    Screen.MousePointer = vbDefault
   
End Sub




-------------
Regards,
Huren



Print Page | Close Window