473,800 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2203
You can use DataTable.Compu te(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*****@hotmai l.com> wrote in message
news:u3******** *****@TK2MSFTNG P11.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********@com cast.nospam.net > wrote in message
news:Oh******** ******@TK2MSFTN GP10.phx.gbl...
You can use DataTable.Compu te(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*****@hotmai l.com> wrote in message
news:u3******** *****@TK2MSFTNG P11.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********@com cast.nospam.net > wrote in message
news:Oh******** ******@TK2MSFTN GP10.phx.gbl...
You can use DataTable.Compu te(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*****@hotmai l.com> wrote in message
news:u3******** *****@TK2MSFTNG P11.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
13487
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 getting second highest value in an integer array. One method I know of is to make the 1st pass through the array and find the highest number. In the second pass we can find the highest number which is less than the number we obtained in the 1st pass.
6
24341
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 the Sort Method ( ) but doesn't seem like it can do the job or am i missing something?
6
1638
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 dataset. I'm using vb. session(sessionName) = recordID 'from dataset or dataview Thanks, Enrique
1
2482
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 is the description of a clothing fldLabel - Which is the band name of the clothing and fldPrice. k, what i need to do is, when i search for a SKU (which might have duplicates) in the db, i want it to return it to a datagrid on the form, and plus...
12
12265
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 slow to retrieve records from sql server. I'm using sqldataadapter.fill method to populate dataset. Parent table contains more than 3,000 records and child table contains more than 10,000 records and grandchild table contains more than 90,000...
4
4898
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 for each item is. How do I do this?
2
2494
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 summarize all the info being passed
10
4377
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 input. I give them a menu to choose from, and I am stuck on only one of the choices. When this choice is picked I must allow the user to enter how many numbers he/she wants to enter; then I must figure out which number is the highest. I have...
3
10661
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
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.