By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,837 Members | 1,842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,837 IT Pros & Developers. It's quick & easy.

retrieve highest number from dataset

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.