473,399 Members | 2,858 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,399 software developers and data experts.

MaxValue

Hi,

How can I pls get the maxvalue and the minvalue in a specific colunm in a
dataset or datareader.
thanks
--
Regads,
Rochdi
Nov 21 '05 #1
9 6345
If you don´t use a query with the MIN(...) and MAX(...) statements to make
the database do the calculation for you, you need to traverse the recordset
yourself to get the min and max values, or sort it by that column and get
the first and last row...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
"Mike" <Mi**@discussions.microsoft.com> escribió en el mensaje
news:46**********************************@microsof t.com...
Hi,

How can I pls get the maxvalue and the minvalue in a specific colunm in a
dataset or datareader.
thanks
--
Regads,
Rochdi

Nov 21 '05 #2
and how to get the first and last record using the dataset facilities
--
Regads,
Rochdi
"Carlos J. Quintero [VB MVP]" wrote:
If you don´t use a query with the MIN(...) and MAX(...) statements to make
the database do the calculation for you, you need to traverse the recordset
yourself to get the min and max values, or sort it by that column and get
the first and last row...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
"Mike" <Mi**@discussions.microsoft.com> escribió en el mensaje
news:46**********************************@microsof t.com...
Hi,

How can I pls get the maxvalue and the minvalue in a specific colunm in a
dataset or datareader.
thanks
--
Regads,
Rochdi


Nov 21 '05 #3
In article <46**********************************@microsoft.co m>, Mike wrote:
Hi,

How can I pls get the maxvalue and the minvalue in a specific colunm in a
dataset or datareader.
thanks


Not sure about the datareader, but you can select datarows via critera
on a datatable using the Select method.

--
Tom Shelton [MVP]
Nov 21 '05 #4

SELECT MAX(Field)
FROM TableName
-----Original Message-----
From: Tom Shelton [mailto:to*@YOUKNOWTHEDRILLmtogden.com]
Posted At: Tuesday, September 20, 2005 12:27 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: MaxValue
Subject: Re: MaxValue

In article <46**********************************@microsoft.co m>, Mike
wrote:
Hi,

How can I pls get the maxvalue and the minvalue in a specific colunm in a dataset or datareader.
thanks


Not sure about the datareader, but you can select datarows via critera
on a datatable using the Select method.

--
Tom Shelton [MVP]

Nov 21 '05 #5
Sorry but I meant from the dataset or reader not from a table in the
database!!!!
--
Regads,
Rochdi
"Marcelo" wrote:

SELECT MAX(Field)
FROM TableName
-----Original Message-----
From: Tom Shelton [mailto:to*@YOUKNOWTHEDRILLmtogden.com]
Posted At: Tuesday, September 20, 2005 12:27 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: MaxValue
Subject: Re: MaxValue

In article <46**********************************@microsoft.co m>, Mike
wrote:
Hi,

How can I pls get the maxvalue and the minvalue in a specific colunm

in a
dataset or datareader.
thanks


Not sure about the datareader, but you can select datarows via critera
on a datatable using the Select method.

--
Tom Shelton [MVP]

Nov 21 '05 #6
In article <8D**********************************@microsoft.co m>, Mike wrote:
Sorry but I meant from the dataset or reader not from a table in the
database!!!!


I'm refereing to a DataTable object in the dataset.

DataRow[] dr = ds.Tables[0].Select ("MAX (COLUMN)");

Basically, you can filter data from a table in a dataset, not the
database.

--
Tom Shelton [MVP]
Nov 21 '05 #7
in my table where my dataset is getting data from I have the colunms "ID" as
integer and "Valid" as Boolean and when applying the following statement :

dr = ds.Tables(0).Select("MAX(ID)")

I'm having the following error:

" Filter expression 'MAX(ID)' does not evaluate to a Boolean term"
how can I fix it?
--

--
Regads,
Rochdi
"Tom Shelton" wrote:
In article <8D**********************************@microsoft.co m>, Mike wrote:
Sorry but I meant from the dataset or reader not from a table in the
database!!!!


I'm refereing to a DataTable object in the dataset.

DataRow[] dr = ds.Tables[0].Select ("MAX (COLUMN)");

Basically, you can filter data from a table in a dataset, not the
database.

--
Tom Shelton [MVP]

Nov 21 '05 #8
In article <63**********************************@microsoft.co m>, Mike wrote:
in my table where my dataset is getting data from I have the colunms "ID" as
integer and "Valid" as Boolean and when applying the following statement :

dr = ds.Tables(0).Select("MAX(ID)")

I'm having the following error:

" Filter expression 'MAX(ID)' does not evaluate to a Boolean term"
how can I fix it?
--

--
Tom Shelton [MVP]
Nov 21 '05 #9
In article <63**********************************@microsoft.co m>, Mike wrote:
in my table where my dataset is getting data from I have the colunms "ID" as
integer and "Valid" as Boolean and when applying the following statement :

dr = ds.Tables(0).Select("MAX(ID)")

I'm having the following error:

" Filter expression 'MAX(ID)' does not evaluate to a Boolean term"
how can I fix it?
--


Actually, that should be something like:

dr = ds.Tables(0).Select("ID = MAX(ID)")

--
Tom Shelton [MVP]
Nov 21 '05 #10

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

Similar topics

2
by: aaapaul | last post by:
I need the maxvalue of 2 colums for each row Select date1, date2, maximum(date1,dat2) as datemax. Is this simple to realize ? date1 and date2 can be NULL. something like this:
4
by: Günter Zöchbauer | last post by:
can anyone tell why is valid but produces compiler error: An attribute argument must be a constant expression, typeof expression or array creation expression
8
by: Pauli Østerø | last post by:
I have a serious problem. I have made an Control which draws a blueprint of a building and a related SpotMatrix. I have made it possible to zoom in on the blueprint and scroll around if the size...
5
by: Markus Kling | last post by:
"double.Parse(double.MaxValue.ToString())" yields the following Exception: Value was either too large or too small for a Double. at System.Number.ParseDouble(String value, NumberStyles options,...
3
by: Olaf Rabbachin | last post by:
Hi folks, I'm have a user-control that imitates a thumbnail-listview. Within, I have a panel (pnlOuter) that represents the viewable area and another panel (pnlInner) which represents the list...
1
by: John | last post by:
Hi, I have an ID column of integer type in my Dataset How can I get the MaxValue in all it's row using the dataset methods or properties? Thanks -- Regads, Rochdi
0
by: Homer J. Simpson | last post by:
When I try to use the following: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:csToolbar %>" SelectCommand="spGetValuesForDateRange"...
1
by: Joey Fontaine | last post by:
I just noticed that, when using intellisense, the DateTime.MaxValue field has a static property icon whereas the Decimal.MaxValue field has a constant property icon. However, when looking at the...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.