Detecting ID of just written DB entry !

Discussion in 'ASP General' started by Jake, Sep 25, 2003.

  1. Jake

    Jake Guest

    I have a DB with 3 fields.
    ID
    Name
    EMail

    If I write an entry into this DB, Name and EMail, the ID is auto
    increment.

    How can I detect what ID has been created ?

    I want a user to submit details to me, they get the ID as a ticket
    number ?

    How can I do this ?

    Thanks
    Jake, Sep 25, 2003
    #1
    1. Advertising

  2. Jake

    Bertrand Guest

    once the table has been updated, you can run a query with
    with Max(ID ) to retrieve the highest (and therefor last)
    ID entered in the ID ... because more than one user can
    add themselves, there is a chance that the answer is
    actually not correct ... so you need to first retrieve the
    Max ID then check that the name + email match the ones for
    that ID and if not then just do Max(ID) - 1 or -2 etc
    until you find the right combination ...
    or you could just run a query bla bla Where Name =
    request.form("Name") AND Email = request.form("Email") ...
    the odds of 2 users with same name + same email is very
    slim of course ... so the second solution is proably
    better ...

    HTH,

    Bertrand


    >-----Original Message-----
    >I have a DB with 3 fields.
    >ID
    >Name
    >EMail
    >
    >If I write an entry into this DB, Name and EMail, the ID

    is auto
    >increment.
    >
    >How can I detect what ID has been created ?
    >
    >I want a user to submit details to me, they get the ID as

    a ticket
    >number ?
    >
    >How can I do this ?
    >
    >Thanks
    >.
    >
    Bertrand, Sep 25, 2003
    #2
    1. Advertising

  3. Jake

    only_me Guest

    see http://www.aspfaq.com/show.asp?id=2174
    Shame you can't have 'sticky' posts in a newsgroup

    <jake @ yono.com (Jake)> wrote in message
    news:...
    > I have a DB with 3 fields.
    > ID
    > Name
    > EMail
    >
    > If I write an entry into this DB, Name and EMail, the ID is auto
    > increment.
    >
    > How can I detect what ID has been created ?
    >
    > I want a user to submit details to me, they get the ID as a ticket
    > number ?
    >
    > How can I do this ?
    >
    > Thanks
    only_me, Sep 25, 2003
    #3
  4. Jake

    Jake Guest

    Thaks to all !

    On Thu, 25 Sep 2003 10:12:52 +0100, "only_me" <>
    wrote:

    >see http://www.aspfaq.com/show.asp?id=2174
    >Shame you can't have 'sticky' posts in a newsgroup
    >
    ><jake @ yono.com (Jake)> wrote in message
    >news:...
    >> I have a DB with 3 fields.
    >> ID
    >> Name
    >> EMail
    >>
    >> If I write an entry into this DB, Name and EMail, the ID is auto
    >> increment.
    >>
    >> How can I detect what ID has been created ?
    >>
    >> I want a user to submit details to me, they get the ID as a ticket
    >> number ?
    >>
    >> How can I do this ?
    >>
    >> Thanks

    >
    >
    Jake, Sep 25, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve C. Orr, MCSD
    Replies:
    1
    Views:
    547
    reaway lee
    Aug 24, 2003
  2. Rob Meade
    Replies:
    0
    Views:
    379
    Rob Meade
    Apr 27, 2004
  3. Elliott
    Replies:
    12
    Views:
    543
    Jacob
    Sep 25, 2004
  4. AtomicBob
    Replies:
    14
    Views:
    857
    Toby Inkster
    May 2, 2006
  5. KaiWen
    Replies:
    102
    Views:
    2,637
    Jorgen Grahn
    Sep 15, 2011
Loading...

Share This Page