Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2740

How to use ADO.Recordset as Datasource for report that does not have a database?

$
0
0

I am using the newest version of CR and I am trying to convert my reports from an older version of CR (8.5).
Some of my reports do not contain a link to a database or contain field definitions (TTX,XML).  In VB6, I simply set the Datasource to the ADO.Recordset then issued a .ReadRecords.  I need to be able to do this still. Below is a watered down example of what my older VB6/CR8.5 did:

 

Private Function MyReport00() As Boolean

   Dim strSQL As String

   Dim iRow As Integer

  

   strSQL = "SELECT * "

   strSQL = strSQL & "FROM MYTABLE"

    

   moRS.Open strSQL, moLogin.Connection(moLogin),adOpenStatic,             adLockReadOnly,             adCmdText

  

   If Not moRS.EOF Then

      Set CrAppl = New Application

      Set moCrystalReport = CrAppl.OpenReport(moRpt2Make)

      With moCrystalReport

         .Database.AddADOCommand moRS.ActiveConnection, moRS.ActiveCommand

         .Database.SetDataSource moRS, 3

         .AutoSetUnboundFieldSource crBMTName

         .ReadRecords

      End With

   End If

   Exit Function

 

 

I am mainly trying to figure out how to make this block work:

      With moCrystalReport

         .Database.AddADOCommand moRS.ActiveConnection, moRS.ActiveCommand

         .Database.SetDataSource moRS, 3

         .AutoSetUnboundFieldSource crBMTName

         .ReadRecords

      End With

 

Any help would greatly be appreciated.


Viewing all articles
Browse latest Browse all 2740

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>