473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Limit rows from a DataSet?

Hi,

I have a DataSet with 30 rows. I pass this DataSet to my reporting
module and this needs the first 10 rows.
Does C# have a way of filtering the DataSet so I can use only the first
10 rows (perhaps using .Select() ) or will I have to create a new
DataSet and pass the rows in one by one?

Thanks in advance.

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Mar 8 '06 #1
2 6977
Steven,

The only way I can think of to do this without copying the rows would be
to have a column that has the row number in it. Then, wrap a DataView
around the DataTable and filter for rows where the row number is <= 10.

Other than that, you would have to create a new datatable and copy over
the appropriate rows.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steven Blair" <st**********@btinternet.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I have a DataSet with 30 rows. I pass this DataSet to my reporting
module and this needs the first 10 rows.
Does C# have a way of filtering the DataSet so I can use only the first
10 rows (perhaps using .Select() ) or will I have to create a new
DataSet and pass the rows in one by one?

Thanks in advance.

Steven

*** Sent via Developersdex http://www.developersdex.com ***

Mar 8 '06 #2
is it possible to do this within SQL via a TOP 10? If that's isn't
possible, the dataview would be the only way.

Mar 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tamer Higazi | last post by:
Hi! I have problems creating joins between tables and to limit rows for a specified clolumn. I have 2 tables! employees departments I face the problems with the GROUP BY clause and i don't...
1
by: Lurre | last post by:
Hallo! I have small or big problem. I want creat Store Procedurs whit limit rows. For example I need rows from 100 to 200. --Select * from table How I doing best way.
2
by: shine | last post by:
I want to retrieve first 3 records of first table and last 4 records of second table, How to do this using c# and dataset? Any suggestion would be greatly appretiated
2
by: Ivan V via DotNetMonster.com | last post by:
Dear All: I would like to know if there are limit rows that can add in the datgrid or not? I got a problem in adding rows in the datagrid. it only allows me to add 5 rows only. Any ideas on...
8
by: John | last post by:
Hi I have a sub method that has been passed a dataset as parameter. I need to insert this dataset into a table. What is the code that I need to do this? The dataset does not have any conflicting...
2
by: Peter S. | last post by:
I am pulling some data from a source via ODBC and placing the information in a DataSet. The first pull is very large but once that is complete I plan to do nightly pulls to get any new data that...
0
Akatz712
by: Akatz712 | last post by:
I may need to post this on another forum, but I will try here first. I have a browser client application which generates a dataset - meaning many rows of data, in an internal javascript array. ...
14
by: adrianga | last post by:
Hi all, My English is not the best so it will be best if I show you an example: I have a query: SELECT Make as , Model as , DERIVATIVE, from MY_VIEW and here is what it returns: MAKE ...
1
by: BaseballGraphs | last post by:
Hello, I am trying to filter an array that I am pulling from a mySQL database using PHP. My question is if there is a way to LIMIT the number of rows that are pulled from the database with a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.