Is this possible

G

Guest

Hi,
I am populating a dataset from a webservice. One one page of my app I need
to get only the first 5 rows from the dataset to pupulate a datagrid and on
another page I then will display all the rows from that dataset in a grid. Is
it possible to select a specific amount of rows from the dataset? Please
don't tell me to use the TOP in a select statement. Remember I am calling a
webservice.

Thanks
 
N

Norman Yuan

Yes, remember you ARE calling a webservice, you only get what the webservice
provides: if the webservice only provides a method that returns you whole
DataSet, you can do nothing about it.
 
G

Guest

If you are receiving the entire dataset, you can store it in a sesison
variable, and use it on your second page.

Regards,

Deepak
[I Code, therefore I am]
 
S

Scott M.

That's not what the question was.

You can just create a separate DataTable that contains the first 5 rows of
the entire datatable in the dataset.
 
W

W.G. Ryan eMVP

Chris:

Once you have the dataset, you can create a DataView on any of the tables.
You may want to add a DataColumn - set its Autoincrement to true and use the
RowFilter to only show those 5 values.

Or you can do a dataTable.Select to get to the same place.
 
W

W.G. Ryan eMVP

Do you really think this is a good way to go? You already have the dataset
and all the data you need is contained therein. Creating another DataTable
will unnecessarily increase resource utilization and provide 0 value - at
least in the sense that you can get to the same place without creating
another table. If he wants to update from that datatable, he'll have to
dance around rowstate if he creates another - again not a big deal but
totally unnecessary.
 
G

Guest

Yes please. A code sample would greatly be appreciated even where I can find
info on this.

Thanks
 

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

Top