•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 422,371 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,552 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
SelectTopFrom method gets the top rows from dataview or datatable
Last edited : Jan 31st, 2008.
public static DataTable SelectTopFrom(DataTable dt, int rowCount) { DataTable dtn = dt.Clone(); for (int i = 0; i < rowCount; i++) { dtn.ImportRow(dt.Rows[i]); } return dtn; } public static DataView SelectTopFrom(DataView dv, int rowCount) { DataTable dt = CreateTable(dv); DataTable dtn = dt.Clone(); for (int i = 0; i < rowCount; i++) { dtn.ImportRow(dt.Rows[i]); } DataView dvn = new DataView(dtn); return dvn; }
Comments (Newest First)
serkansendur | Posting Whiz in Training | Jan 31st, 2008
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)
I think it is better to seperate these two snippets