dataset query

Posted on 2011-10-28
Last Modified: 2012-06-21
How does u get record no from 5 to 15 from a dataset of 100 records
Question by:KaranGupta
    LVL 2

    Accepted 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

    LVL 51

    Expert Comment

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now