R – How to return a Dataset using Subsonic 3

datasetsubsonic-active-recordsubsonic3

I have some old code that was using Subsonic 1.x and want to migrate to 3. Some of my old methods used to return a Dataset using the old Subsonic Query object and then just calling ExecuteDataset().

I still need to support those methods, since they're called by other code…however, I can't find anywhere how to to a code query with Subsonic that will let me return a Dataset. Or is that completely gone??

Can anyone help? Thank you!

Best Answer

You can return execute a Reader and then Load the data from the reader to the datatable, something like this:

    SubSonic.Query.SqlQuery qry= new Select().From<Evento>().Where(EventosTable.FechaInicioColumn).IsEqual(3);
    System.Data.IDataReader reader = qry.ExecuteReader();
    System.Data.DataTable table = new System.Data.DataTable();
    table.Load(reader);
Related Topic