Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    358
    Thanks
    2
    Thanked 0 Times in 0 Posts

    retrieve same number

    dear,

    i face a terrible problem!!

    i want to do a registration form with a serial number, but the serial number is get from a table to generate a running number, then add 1 to increase the number, but now my problem is user may get two same seial number when user save the record at the same time.

    how to solve??!!!
    Thanks.
    =====================================================
    From NinjaTurtle
    ++http://ohmygoh.blogspot.com|http://technology.ohmygoh.com++

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Is the number generated after the user submits the form?
    If so, I suppose its possible that two users could it the button at the same time, but it seems highly unlikely. I mean they'd have to hit the button at the same exact milisecond and have the same internet connection and the same path the to the server. The database can runs commands in nanoseconds, so it would be nearly impossible to get the timing right for a duplicate to happen. Unless I miss understand what you are saying.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you're using your autoincrement (primary key) field, here's the solution - I had to use this yesterday, it's very simple!

    http://www.4guysfromrolla.com/webtec...122600-1.shtml

    I used the code provided there with almost NO modification. Works great.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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