SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Aug 2000
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting the Last record

    Is there a way to retrieve and print out the last record ( a particular field) that was inserted into a database using ASP?

    for example:I need to print out the Primary key ID field that was last placed into the database.

    Any help/tips on how to accomplish this would be gratly appreciated.

    Thank you

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not very good with ASP, but I have some suggestion.
    Why don't you add 1 field for date and the value is =now()
    So if you want to select the last record then you can sort by the last date. Is it helping ?

  3. #3
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you use an autonumber number the feilds then make your sql to get it the following;

    Code:
    SELECT max(autonumber feild name) FROM table name
    if you dont, use teh following;
    Code:
    Set getInfo = con.Execute("SELECT * FROM table")
    getInfo.MoveLast


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
  •