Use DataView to return the first n rows

  • Thread starter Thread starter Stephen Miller
  • Start date Start date
S

Stephen Miller

Can you use a DataView to return only the first say 10 rows of a
dataset? If so, how?

Thanks,
 
Hi Stephen,

No, you can't. You could if each row would carry a row number (by setting
RowFilter property).
 
You most likely need to perform this logic in the code that uses your
DataView.
For example, databound controls such as DataGrid implement their own paging.

Otherwise, use DataView.CopyTo() to copy items into an array, then copy just
the rigth number of records into another array, e.g. ArrayList.

-Oleg.
 
Back
Top