"Expects class Rowset " error?

Not sure how to solve this. I am working on a code to print the data from a Rowset and am using the same code to select data from the database to fill a listbox, no errors there. But when I use it in a new code for printing the data, I get this error:

Parameter "rs" expects class RecordSet, but this is class RowSet.
PrintMyReport(rs, ReportChapters)

This is the code I am using to collect the data from the table:

Try
  Var rs As RowSet
  rs = app.DB.SelectSQL("SELECT * FROM Write") 
  if rs <> Nil Then
    PrintMyReport(rs, ReportChapters)
    rs.Close
  End if
  rs =  nil
  db = nil
Catch error As DatabaseException
  MessageBox("Error: " + error.Message)
End Try

I tried changing “Var rs As Recordset”, but that doesn’t seem to be the solution. How do I solve this? I am using Xojo 2022 r2.

Check your method PrintMyReport( ...)

I guess it needs an update and right now it expects a legacy RecordSet

The PrintMyReport method has this code:

If rs = Nil Then
  MessageDialog.Show "There is no data in the recordset. Printing Cancelled"
Else
  Var ps As New PrinterSetup
  ps.MaximumHorizontalResolution = -1
  ps.MaximumVerticalResolution   = -1
  If ps.ShowPageSetupDialog Then
    Var g as Graphics
    g = OpenPrinterDialog(ps,Nil)
    If g <> Nil Then
      Var Rsq as New Reports.RecordSetQuery(rs) //Put the records into a Reports.DataSet
      If rpt.Run( Rsq , ps ) Then //check to make sure the report runs
        rpt.Document.Print(g) //Print the report
      End If
    End If
  End If
End If

It has a RecordSetQuery and cannot changed to a RowSetQuery as I hoped.
I took the code examples from the “I wish How to Program SQLITE…” pdf and I wonder if this could have anything to do with the fact that Eugene is using ApI 2?

The PrintMyReport code code you update later, the first part is the signature.

I see… not your code. Well… you will need to update Eugene’s legacy code if you want to use RowSets.