tags:

views:

106

answers:

3

Hello All

What is the total no of records that can be fetched in a Ado.Net datatable?

+1  A: 

More detail : What is the maximum of record dataset can hold?

you can have 2^32 rows inside a DataTable and 2^ 32 tables inside a dataset. thats somewhere around 2 billion. But having so many records (~billion) is not a good approach. And you run the risk of crossing the datatable record limit too, sooner or later. Its advisable that you get the records in chunk, I mean in the report the user will not see everything in one go, it can be difficult for him to scroll through all the data, so use custom pagination, i.e. show only 100 (or any fixed number) of records in one page, this way you will save bandwidth as well as make your app faster

Pranay Rana
Shouldn't the max size of `int` be the limit?
Bobby
To be precise `2^32` is over 4 bilion not 2 bilion. `int32.MaxValue` is `2^31 -1`. One bit is used to store sign.
Andrzej Nosal
+3  A: 

The DataRowCollection has an indexer with an int parameter, so Int32.MaxValue.

Or the size of your available memory, whatever comes sooner.

Hans Kesting
+2  A: 

Well, the Rows.Count property is an Int32, so I'd be making a guess the upper limit is int.MaxValue (2147483647).

Dave