dataset query

How does u get record no from 5 to 15 from a dataset of 100 records
Who is Participating?
        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"

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.