How to return a Dataset using Subsonic 3?
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!
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);
I have not used this in SubSonic 3.0, but the SubSonic.DataProviders.DbDataProvider
object has an ExecuteDataSet
method that takes a QueryCommand
object. That might be what you need.
精彩评论