| Author |
Topic |
|
JmaC
Starting Member
18 Posts |
Posted - 2010-09-12 : 22:59:22
|
| hi all..i have create a registration form in asp.net & SQL server..everything was working good..now the problem is when two user register at same time it'll generate same user ID for both..the form will generate user ID when user click "Register" button. Until they fill up form and click "submit" it'll not save into database.how can i avoid this problem..?what is the correct method to handle this problem..Thanks & RegardsJmaC |
|
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-09-13 : 00:17:22
|
| From SQL Server perspective this is impossible. When a transaction is commited, in the time of inserting the data into table, this same table is being locked for any other operations. So if you have several people clicking register button at the same time, SQL server will handle each one of them separately, preventing "dirty" inserts.I suggest you to create identity column in your table where you store registration information. once you have identity, you will see that SQL server is handling each row/each insert/each new user as different entity.You must check also you asp.net code, how you are handling data and how you are inserting data into table. |
 |
|
|
saravinter
Starting Member
1 Post |
Posted - 2010-09-13 : 00:43:33
|
| You need to check the Identity of the before inserting a new Record.Thanks & Regards,Saravanan R |
 |
|
|
kashyap.2000
Starting Member
22 Posts |
Posted - 2010-09-13 : 02:47:54
|
| In sql its little difficult, but by using thread concept you can easily achive this. you can program this using treads concepts so that it processes request one by one rather than processing all, there are some features in thread programing which can help you. |
 |
|
|
JmaC
Starting Member
18 Posts |
Posted - 2010-09-13 : 03:37:26
|
quote: Originally posted by kashyap.2000 In sql its little difficult, but by using thread concept you can easily achive this. you can program this using treads concepts so that it processes request one by one rather than processing all, there are some features in thread programing which can help you.
thanks kashyaphow to use thread in my problem.(am totally beginner in SQl)can you please explain me more..thanks againThanks & RegardsJmaC |
 |
|
|
DuncanP
Starting Member
12 Posts |
Posted - 2010-09-13 : 08:54:32
|
| The problem is caused by generating ID's before the user has registered. Therefore the easy solution is to leave that until the registration is complete and the data is saved to the database. The common way to do this in SQL is with the identity column (as pointed out by slimt_slimt).If you can't use auto-generated ID's provided by the identity property and need to generate your own, then you need some way to store the generated ID value temporarily whilst the registration process completes. How you do this would depend on how your application is set up. But at least you could check these values before generating a new one.Duncan |
 |
|
|
kashyap.2000
Starting Member
22 Posts |
Posted - 2010-09-13 : 10:10:45
|
quote: Originally posted by JmaC
quote: Originally posted by kashyap.2000 In sql its little difficult, but by using thread concept you can easily achive this. you can program this using treads concepts so that it processes request one by one rather than processing all, there are some features in thread programing which can help you.
thanks kashyaphow to use thread in my problem.(am totally beginner in SQl)can you please explain me more..thanks againThanks & RegardsJmaC
Hi Jmacyou can refer below link which will you explain the thread from basic, so go through this , if you still have problem , then please post it back , so we can help you furthurhttp://www.albahari.com/threading/ |
 |
|
|
JmaC
Starting Member
18 Posts |
Posted - 2010-09-14 : 21:13:34
|
| hi all...i have an idea...what about if recheck the "AccNo" from form when i click submit and update ID...currently i using this sql command to get "AccNo" from database to the form in drop Down List...SELECT min(AccNo)FROM (SELECT AccNo + 1 AS AccNo FROM Debtor EXCEPT SELECT AccNo FROM Debtor)AS newAccNo WHERE AccNo >300000000-my AccNo start from 300000000-i already have data in my database more than 2000if i click "SAVE" button it'll check the "AccNo" in the form with databse and update automatically to new AccNo..Can anyone help me guide how to do this...Thanks & RegardsJmaC |
 |
|
|
|