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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top