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

x
  • 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
0
KaranGupta
Asked:
KaranGupta
1 Solution
 
owaisyahyaCommented:
        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

0
 
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"

http://msdn.microsoft.com/en-us/library/system.data.dataview.rowfilter(v=vs.71).aspx

0

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