473,395 Members | 1,738 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,395 software developers and data experts.

retrieve highest number from dataset

Hello,

How would I get the highest number from a column? The table has an ID column
but it does not auto imcrement and I have to do it manually so I need to get
the hihest integer value and increment it by one before adding data to the
dataset.

Thanks,
Grant
Nov 16 '05 #1
3 2177
You can use DataTable.Compute(Max(IDColumn), "IDColumn> -1")

The filter is BS, it's just a condition that will always be false.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

"Grant" <gp*****@hotmail.com> wrote in message
news:u3*************@TK2MSFTNGP11.phx.gbl...
Hello,

How would I get the highest number from a column? The table has an ID column but it does not auto imcrement and I have to do it manually so I need to get the hihest integer value and increment it by one before adding data to the
dataset.

Thanks,
Grant

Nov 16 '05 #2
Thanks for your reply - Ill give it a go.
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:Oh**************@TK2MSFTNGP10.phx.gbl...
You can use DataTable.Compute(Max(IDColumn), "IDColumn> -1")

The filter is BS, it's just a condition that will always be false.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

"Grant" <gp*****@hotmail.com> wrote in message
news:u3*************@TK2MSFTNGP11.phx.gbl...
Hello,

How would I get the highest number from a column? The table has an ID

column
but it does not auto imcrement and I have to do it manually so I need to

get
the hihest integer value and increment it by one before adding data to
the
dataset.

Thanks,
Grant


Nov 16 '05 #3
Thanks Bill that works.
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:Oh**************@TK2MSFTNGP10.phx.gbl...
You can use DataTable.Compute(Max(IDColumn), "IDColumn> -1")

The filter is BS, it's just a condition that will always be false.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

"Grant" <gp*****@hotmail.com> wrote in message
news:u3*************@TK2MSFTNGP11.phx.gbl...
Hello,

How would I get the highest number from a column? The table has an ID

column
but it does not auto imcrement and I have to do it manually so I need to

get
the hihest integer value and increment it by one before adding data to
the
dataset.

Thanks,
Grant


Nov 16 '05 #4

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

Similar topics

21
by: Jaspreet | last post by:
I was working on some database application and had this small task of getting the second highes marks in a class. I was able to do that using subqueries. Just thinking what is a good way of...
6
by: Ada | last post by:
hello folks, is there a way to retrieve the highest value in the ArrayList? let say i have a value in the array: {1, 4, 15, 3, 7} it should return a value 15 as the result. i've looked at...
6
by: enrique | last post by:
Hello, I simpy want to place a record ID into a session variable. I know how to create session variables, I'm just can't figure out the syntax for the record item when I'm working with a...
1
by: Neil | last post by:
Hello everyone, I am making a program at the moment, and need HELP!!!. I'll start with the database, my field's r: fldSku - which a 6 digit number, no more no less (145682) fldDescription - which...
12
by: jaYPee | last post by:
I have currently using a dataset to access my data from sql server 2000. The dataset contains 3 tables that is related to each other. parent/child/grandchild relationship. My problem is it's very...
4
by: johnk | last post by:
I have a table of items, with revision numbers. I need to extract the items with highest revision number. The items may be listed several times and I don't know what the highest revision number...
2
by: Joe | last post by:
Hi I am going to receive a dataset downstream and I will not know the the fields number of field relations number of relations So I have to be flexible to take unknown data and be able to...
10
by: strife | last post by:
Hi, This is a homework question. I will try to keep it minimal so not to have anyone do it for me. I am really just stuck on one small spot. I have to figure out the highest number from a users...
3
by: MyMarlboro | last post by:
i wonder am i make a mistake or not... use Data::Dumper; my @array= qw(1 2 3 4 5 6 8 9 2 5); my $highest=@array; foreach my $number (@array) { if (@array > $highest) { $highest = @array;
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.