Hi,
First time you time you have to generate the ID as EMP0001.
For Example : Get this value in a string.
first time check whether there is a record in the database by using the query.
Query = "select * from tablename.
Get the values in a datatable.
if the count value is equal to zero
then follow the following step:
if(dt.rows.count == 0)
{
string strID = "EMP0001";
}
Insert this value in the Employee ID column.
so, Next time the value will not be equal to zero.
If this value has been inserted in the table, you have to use the following query to autogenerate the ID.
select isnull(max(right(nvrempcode,4)),0)+1 as nvrempcode from tablename.
This query will autogenerate the ID.
Thanks && Regards,
V. Santhi.
Thanks & Regards,
Santhi .V
reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator