locked
Get the biggest number in database column! RRS feed

  • Question

  • User585571002 posted

    Hello,

    I'm trying to get the biggest number in database like in the photo

    For example the biggest number is 31, and the when I click a button it will increment with one. For example if a press button ADD in database it will be added number 32. I want to do it programmatically.

    Thank You.

    Thursday, February 20, 2014 10:02 AM

Answers

  • User753101303 posted

    Don't you have a database ? If those values are stored in a database you'll send a SQL statement to your database to get the result. See http://msdn.microsoft.com/en-us/library/h43ks021(v=vs.110).aspx for the db access technologies.

    Another option is to use EF that gives access to your data as objects (it uses SQL under the hood as this is basically the only way to interact with a db). It's a bit hard to give detailed direction in a forum if you are a total beginner with all of this (both because it would involve mutliple subjects and because we have no idea what we would need to explain and what is know already).

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 21, 2014 12:28 PM

All replies

  • User753101303 posted

    Hi,

    Read up about SQL. For example : http://www.w3schools.com/SQl/sql_func_max.asp or http://www.w3schools.com/sql/sql_autoincrement.asp (I'm not sure what represent this number but it does have also auto-incremented numbers).

    I assume your issue is just on the SQL side that you are still learning ?

    Thursday, February 20, 2014 11:11 AM
  • User585571002 posted

    I want to do it programmatically in ASP.NET.

    Friday, February 21, 2014 10:55 AM
  • User753101303 posted

    Don't you have a database ? If those values are stored in a database you'll send a SQL statement to your database to get the result. See http://msdn.microsoft.com/en-us/library/h43ks021(v=vs.110).aspx for the db access technologies.

    Another option is to use EF that gives access to your data as objects (it uses SQL under the hood as this is basically the only way to interact with a db). It's a bit hard to give detailed direction in a forum if you are a total beginner with all of this (both because it would involve mutliple subjects and because we have no idea what we would need to explain and what is know already).

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 21, 2014 12:28 PM