In fact, if the paging does not require high performance, you can use
Dataadapter. Fill (INT startrecord, int maxrecords, Params datatable [] datatables) Method
The principle is while (0 <startrecord)
{
If (! Container1.read ())
{
Return 0;
}
Startrecord --;
}
Int num1 = 0;
If (0 <maxrecords)
{
While (num1 <maxrecords) & container1.read ())
{
If (this. _ hasfillerrorhandler)
{
Try
{
Mapping. loaddatarowwithclear ();
Num1 ++;
}
Catch (exception exception1)
{
If (! ADP. iscatchableexceptiontype (exception1 ))
{
Throw;
}
ADP. traceexceptionforcapture (exception1 );
This. onfillerrorhandler (exception1, mapping. able, mapping. datavalues );
}
Continue;
}
Mapping. loaddatarow ();
Num1 ++;
}
Return num1;
}
This is the code from reflector. We can see that it uses datareader. Read to specify the number of rows.
The read method does not consume much time. If the access speed requirement is not extremely demanding,
This method is completely usable.
This will not cause the returned able or dataset to be too large.
In fact, even a few of the thousands of pieces of data have patience.