Right now I’m using
OleDbDataAdapter objDataReader = new OleDbDataAdapter();
objDataReader.SelectCommand = myCommand;
objDataReader.Fill(myDataTable);
But I feel the DataTable object is a massive bloated object, I’d like to know if there’s a way I can make my own object to send to data reader, or use a lighter one?
You call the DataTable‘s Load method to load the data into it using a
IDataReader. You said it the other way around, which is not true.As far as the DataReader is concerned, this is in fact very fast. If you don’t like using a DataTable, you can look at other alternatives such as Entity Framework or simply hydrating your own custom business objects by iterating through the DataReder as so: