locked
Registration RRS feed

  • Question

  • User-809550105 posted

    I have made an applicaition which is registration. In this when more than one user clicks at the same time then in the database.

    2 ids generate with same number. 

    Can any one tell me how can i solve this. and does Applications.Lock()  before obj.Registration()     and Applications.UnLock() 

    after registration works ?

    Saturday, December 15, 2012 3:26 AM

Answers

  • User1410450975 posted

    if you want to get this auto generate id then please use

    SELECT @@IDENTITY 
    or
    SELECT SCOPE_IDENTITY() 
    both are return last generte id with no confilct 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 15, 2012 4:44 AM
  • User260886948 posted

    Hi Harman,

    You can try to use the GUID(Globally Unique Identifier ) which can be used to uniquely identify something. For example when we store users or products in our database and we want somehow uniquely identify each row in the database. A common approach is to create a autoincrementing integer, another way would be to create a GUID for our products.

    You can do as the below:

    Guid userID = Guid.NewGuid();
    

    Best Regards,
    Amy Peng

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 19, 2012 8:59 PM

All replies

  • User1410450975 posted

    if you want to get this auto generate id then please use

    SELECT @@IDENTITY 
    or
    SELECT SCOPE_IDENTITY() 
    both are return last generte id with no confilct 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 15, 2012 4:44 AM
  • User260886948 posted

    Hi Harman,

    You can try to use the GUID(Globally Unique Identifier ) which can be used to uniquely identify something. For example when we store users or products in our database and we want somehow uniquely identify each row in the database. A common approach is to create a autoincrementing integer, another way would be to create a GUID for our products.

    You can do as the below:

    Guid userID = Guid.NewGuid();
    

    Best Regards,
    Amy Peng

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 19, 2012 8:59 PM