Click here to Skip to main content
15,883,843 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello friends.. Please help me with this. I have tried a lot.But nothing happened.
Posted

Are you saving this against the user details in the database? If yes, it's best to generate it in the database itself. And if needed get it to your application after it is saved. You may also define an identity field for this number in the database. And you can retrieve the value of this field using @@Identity system function[^].
 
Share this answer
 
Comments
[no name] 25-Mar-14 1:54am    
Correct. Thus it generates itself. Unfortunately OP has given no clue as to what has been tried where "nothing happened".
Ankur\m/ 25-Mar-14 2:24am    
Exactly. But I tried to answer what I understood from the question. OP should reply if that isn't what he wants.
[no name] 25-Mar-14 2:27am    
I'm assuming the downvote is your answer.
Ankur\m/ 25-Mar-14 5:12am    
I didn't notice the down-votes. I have encountered yours as well.
C#
Random _r = new Random();
int id = _r.Next();
 
Share this answer
 
Comments
VadhulGanesh 27-Mar-14 6:37am    
hello pwasser.. Thank you for helping me. now it is working properly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900