Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

dataset query

How does u get record no from 5 to 15 from a dataset of 100 records
1 Solution
        DataRow[] dr=new DataRow[5];
        int rowcount = 0;
        DataSet ds = new DataSet();//assume that dataset is already filled with hundred records
        for (int i = 4; i < 15; i++)
            dr[rowcount] = ds.Tables[0].Rows[i];                            
        //your code to manipulate/use these rows

Open in new window

HainKurtSr. System AnalystCommented:
what is your db? if it is sql server add a new column

row_number() over (order by some columns here) rn

now yor dataset will have a new column named rn, which you can use filter

ds.defaultview.rowfilter="rn between 5 and 15"



Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now