dataset query

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