Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 31-01-2009
Member
 
Join Date: Aug 2008
Posts: 281
Getting the MAX value from a column

I want to find out the maximum value in this situation.

dataset = dataset11
Table name = Student
Column name = RegistrationID

txtMaxRegistrationID.text = dataset11.Student.RegistrationID ??

Please help i am a beginner with VB.
Reply With Quote
  #2  
Old 31-01-2009
Member
 
Join Date: Dec 2007
Posts: 38
Re: Getting the MAX value from a column

hey
Try using the MAX function in the
select query on the DataSet:

dataset11.Select("SELECT MAX(RegistarationID) FROM [Student]...")
Reply With Quote
  #3  
Old 31-01-2009
Member
 
Join Date: Aug 2008
Posts: 103
Re: Getting the MAX value from a column

why do you not just use a dataview?

rough code

dv as new dataview(dataset11.Student)
dv.sort="RegistrationIdColumn, ASC"
txtMaxRegistrationId.text=dv(dv.count-1)("RegistrationID")
Reply With Quote
  #4  
Old 31-01-2009
Member
 
Join Date: Aug 2008
Posts: 281
Re: Getting the MAX value from a column

Hey I want to know how to use other functions like MAX in the sql statement using vb.net.
Reply With Quote
  #5  
Old 31-01-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Getting the MAX value from a column

I found the easiest way for this
DataTable.Compute function.
txtMaxStaffID.text = dataset11.Employee.Compute("Max(StaffID)", Nothing)
The second parameter is a filter, incase you want to limit the rows that are
applied to the aggregate function.

David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS Press
covers the DataTable.Compute function along with every thing else in
ADO.NET!
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Getting the MAX value from a column"
Thread Thread Starter Forum Replies Last Post
Sort a row or column in MS Excel Itronix Tips & Tweaks 1 15-06-2011 09:52 AM
Find The Value of one column in another column Charth Windows Software 3 23-02-2011 03:01 AM
PDF with two column in Kindle DX Zhankana_n Portable Devices 5 19-03-2010 09:40 AM
How to highlight identical cell value of one column in another column? D_chapple Windows Software 3 09-12-2009 01:11 PM
mysql update column with another column Gunter Software Development 3 23-05-2009 09:44 AM


All times are GMT +5.5. The time now is 11:24 PM.