Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2008, 02:57 PM
Authorized User
 
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tusharkale
Default fecthing rows between 1 to 1000 to datatble.

Hi,

I have dataset with 3 datatables.
datatable1,datatable2 and datatable3

Datatable1 contains 20000 records.

Now I want to fetch rows between 1 and 1000 only in datatable2
and from 1001 to 2000 in datatable3.

How can I do that?

Any help/tutorial on this would be a great help

Thanks




 
Old August 8th, 2008, 03:25 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well there are numerous ways of doing it, you could filter on the server before it gets to the DataSet, iterate through and read the data from the tables 1 row at a time, you could lay a view over the top of the table to filter..

My first question is why retrieve the data from the DataSet and not filter before it gets there? (i.e. at the server?)
Only 1000 records from a 20000 record DataSet seems like an awful amount of memory to waste...


Rob
http://cantgrokwontgrok.blogspot.com
 
Old August 9th, 2008, 02:35 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You don't mention what database you are using. This would have been quite helpful seeing as your question is basically a database question.

If you are using SQL Server 2005 or greater then you can use the row_number() function:

http://msdn.microsoft.com/en-us/library/ms186734.aspx

If you are using MySql then you can use the LIMIT keyword

http://dev.mysql.com/doc/refman/5.0/en/select.html

If you are using Oracle then there is ROWNUM.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
<httpRuntime executionTimeout="1000" maxRequest anil.goyal ASP.NET 1.0 and 1.1 Basics 4 May 27th, 2008 10:58 AM
Stored Procedure returns EXPR 1000 EDGiridhar Crystal Reports 1 June 14th, 2007 12:58 PM
active directory: problem with 1000 returns empty C# 2005 0 November 18th, 2005 04:39 AM
Chaper 14 - over $1000 problems ftb_tx BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 November 21st, 2004 09:15 PM
fecthing from a join select mkoohian BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 October 22nd, 2003 09:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.