0

I want to check an assumption I've always made. I was having a brief discussion with a team mate where he suggested that DataAdapter Fill was faster than using a DataReader to retrieve data as it didn't iterate through the records. I suggested that the opposite was true and the DataReader was the most efficient (by a very small margin and dependent on how you use it etc, etc) and anyway DataAdapter used DataReader "under the skin" anyway. When I've briefly looked at the source code that always seems to be the case.

However I thought I should check my assumption, so I Googled a bit and saw people saying that with DataTable/Set + DataAdapter "the whole chuck is moved across the network in one large hit". How is this possible? Or is it as I always thought just an abstraction over a data reader and it still iterates through the rows while filling the DataTable/Set.

If this question sounds like it should have been made 10 years ago then it's because we are dealing with legacy code connecting to an Oracle database. Just want to make sure I have a clear and correct understanding.

Jules 999
  • 125
  • 1
  • 9
  • Does this answer your question? [Does a .NET SqlDataReader object use a database cursor, or the whole result set is loaded into RAM?](https://stackoverflow.com/questions/43452148/does-a-net-sqldatareader-object-use-a-database-cursor-or-the-whole-result-set) – GSerg Jan 28 '20 at 11:41
  • @GSerg not directly but in that it suggests what I always thought happened is right. A DataAdapter.Fill just uses a DataReader to read all of the records into a DataSet. There is no special "magic" I am missing that could make a Fill quicker/more efficient. – Jules 999 Jan 28 '20 at 12:04

0 Answers0