Results 1 to 2 of 2


  1. #1
    Gogy Guest

    Default GOING CRAZY!

    I have been having problems assigning value returned from SELECT MAX(id) statement to a variable. I want to retreive the highest id number and add 1 to it before inserting a new record. This way I control the key in database because I will need to reffer to it later.<BR>My select statement is <BR>set rsAddress = Conn.Execute("SELECT MAX(address_id) from address_book)<BR>now I want to be able to take<BR>rsAddress("address_id") and add 1 to it.<BR>I just can&#039t figure out the syntax for this in ASP?!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: GOING CRAZY!

    OK, here is the syntax!<BR><BR>&#039Create a variable to store rsAddress("Address_id")+1<BR>Dim AddIDPlusOne<BR>AddIDPlusOne = CInt(rsAddress("address_id")) + 1<BR><BR>There ya go! :) CInt() casts rsAddress("address_id") as an integer. We then add one to it! :) Have a great day, and happy programming!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts