Results 1 to 5 of 5

Thread: Getting the MAX value from a column

  1. #1
    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.

  2. #2
    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]...")

  3. #3
    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")

  4. #4
    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.

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    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!

Similar Threads

  1. Sort a row or column in MS Excel
    By Itronix in forum Tips & Tweaks
    Replies: 1
    Last Post: 15-06-2011, 09:52 AM
  2. Find The Value of one column in another column
    By Charth in forum Windows Software
    Replies: 3
    Last Post: 23-02-2011, 03:01 AM
  3. PDF with two column in Kindle DX
    By Zhankana_n in forum Portable Devices
    Replies: 5
    Last Post: 19-03-2010, 09:40 AM
  4. Replies: 3
    Last Post: 09-12-2009, 01:11 PM
  5. mysql update column with another column
    By Gunter in forum Software Development
    Replies: 3
    Last Post: 23-05-2009, 09:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,752,116,568.20032 seconds with 16 queries