generating a number

tanya2001

New member
Joined
Oct 18, 2007
Messages
4
Programming Experience
Beginner
Hi

I am in need of urgent help as i am approaching the deadline of my project
I have a database which has a field empid in it
I have a button called submit in my webform.So when i click this button submit i want the "empid" field in the database to generate a number automatically.When ever i click submit the "empiid" number in the database should be incremented.

how can i do this
please help me
can we use a method called new GUID
if yes how can we use this please explain me in details
you can even email me with the solution at urs_forever_tanya2001@yahoo.co.in
 
1. You can set the empiid as a identity column in your SQL Server, so that when ever a new record is insterted into the table the empid will be automatically incremented by SQL Server itself.
2. If you dont want to use Identity column, then you will have get the max(EmpId) from the table, increment by 1 every time you insert a new record into the database table.
3. Using GUID will help to only generate random values and they will not be in a sequence.
Send PM if you have any queries.
 
Back
Top