.netperformancedatatabledatareaderdataadapter

Is datareader quicker than dataset when populating a datatable?


Which would be quicker.

1) Looping a datareader and creating a custom rows and columns based populated datatable

2) Or creating a dataAdapter object and just (.Fill)ing a datatable.

Does the performance of a datareader still hold true upon dynamic creation of a datatable?


Solution

  • The DataAdapter uses a DataReader under the hood so your experience would likely be the same.

    The benefit of the DataAdapter is you cut out a lot of code that would need maintenance.

    This debate is a bit of a religious issue so definitely look around and decide what works best for your situation: