472,986 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Min max from Dataset

I have a data set that I would like to get the min max for a column but only
from a range of records ie the 20th thru the 33rd record. Could someone point
me to some sytax to do this.

Thanks in advance - Dan
Aug 21 '08 #1
3 3902
somthing like the below

select min(somecolumn), max(SomeColumn) from sometable (nolock)

where somecolumn >= somvalue and somecolumn <= somvalue

look at the Sql Between clause also

DaveL

"Dan" <Da*@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
>I have a data set that I would like to get the min max for a column but
only
from a range of records ie the 20th thru the 33rd record. Could someone
point
me to some sytax to do this.

Thanks in advance - Dan

Aug 21 '08 #2
On Aug 21, 2:29*pm, "DaveL" <dvs_...@sbcglobal.netwrote:
somthing like the below

select min(somecolumn), max(SomeColumn) from sometable *(nolock)

where somecolumn >= somvalue and somecolumn <= somvalue

look at the Sql Between clause also

DaveL

"Dan" <D...@discussions.microsoft.comwrote in message

news:A8**********************************@microsof t.com...
I have a data set that I would like to get the min max for a column but
only
from a range of records ie the 20th thru the 33rd record. Could someone
point
me to some sytax to do this.
Thanks in advance - Dan
Sorry, could you elaborate on what you want to achieve?
If I understand correctly, you're trying to get the row that has the
minimum value for some column in a table, and the same thing for the
row that has the maximum value.
DaveL posted code to get the value from a SQL Server database, but you
have a dataset, so it's much different (and easier!)
I'll post some code ASAP.

Also, if you do it your own way, don't forget to cast the values to an
int, so that C# knows how to compare the values.
Aug 22 '08 #3
On 21 Aug., 22:55, Dan <D...@discussions.microsoft.comwrote:
I have a data set that I would like to get the min max for a column but only
from a range of records ie the 20th thru the 33rd record. Could someone point
me to some sytax to do this.

Thanks in advance - Dan
I'm assuming you mean DataTable, otherwise the question is not quite
clear.
If the values you want to compare are ints, something like this should
work:

for (int i = startIndex; i <= endIndex; i++)
{
int value = Convert.ToInt32(table.Rows[i].ItemArray[columnIndex]);

if (value highest)
{
highest = value;
}
else if (value < lowest)
{
lowest = value;
}
}

hth,
Kevin Wienhold
Aug 22 '08 #4

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

Similar topics

3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
3
by: Jeronimo Bertran | last post by:
Hi, I have an xml file that encapsulates a dataset definition within a set of tags (<dataset>)... here is an example <?xml version="1.0" encoding="utf-16"?> <dataset> <MyTable>...
5
by: Mike | last post by:
I need to expand the DataSet class by inheriting from it and adding functions that work on the data in the tables. However, since I can't upcast how can I get my base DataSet object assigned an...
3
by: JJ | last post by:
Hi, I need to pass a dataset to another win form along with a SqldataAdapter. I don't want to recreate the SqlDataAdapter again either. So to pass to another Win form in my windows form app, do...
5
by: Jason | last post by:
I am having problems understanding how to access a datasource only once, fill a single dataset, and then reference that dataset multiple times through different user controls(ascx) found on the...
2
by: John Holmes | last post by:
I have a web interface where the user types in ID's one at a time. After an ID is typed in, a button is clicked and the button click event has code that does a query and returns a data reader and...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
1
by: matt | last post by:
hello, i have a web app that allows users to query our oracle db and produce a dataset of report data. they then have the option to serialize this data and store it in the database. later, then...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.