Results 1 to 3 of 3

Thread: asp record

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    24

    Unhappy asp record....URGENTTTTTTTTTTTTTTTTT

    I enter a record in a table. How do I get the id of that record if the id is an autonumber?
    Code pleazz....
    Last edited by loverpal; Apr 1st, 2001 at 03:39 PM.

  2. #2
    Addicted Member JasonGS's Avatar
    Join Date
    May 2000
    Location
    California
    Posts
    155
    Im assuming by autonumber, you mean Access... The only way (I know) is to do a "SELECT id FROM table ORDER BY id DESC", and then move to the first record, that would be the last record you inserted. If you have a high volume of users, that split second select could get corrupted by another insert. I've never seen that happen, but that's not to say it can't

    SQL Server has a @@IDENTITY "function" that essentially does the exact same thing - it echoes the last primary key inserted into a table.

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    here's some a link to some code for you, its in VB so you'll just need to convert it to VBScript

    http://www.vbforums.com/showthread.p...threadid=50949

Posting Permissions

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



Click Here to Expand Forum to Full Width