Which DataSet creation technique is faster?
Which one of these techniques is faster?
1)
DbDataAdapter dataAdapter = _factory.CreateDataAdapter();
dataAdapter.SelectCommand = _command;
dataSet = new DataSet();
dataAdapter.Fill(dataSet);
2)
DataTable dt = new DataTable();
IDataReader iDataReader= _command.ExecuteR开发者_StackOverfloweader();
dt.Load(iDataReader);
iDataReader.Close();
Have a look at these links
DataReaders, DataSets, and performance
and
DataAdapter.Fill preferable to DataReader?
As mentioned in the comments to your question. It would be best to test for the given situation at hand, there is never a one rule applies to all.
精彩评论