Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Generate Employee ID (SCS-0001,SCS-0002......)
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Amyn Kapadia
Generate Employee ID (SCS-0001,SCS-0002......)
5 Answer(s)      a year and 7 months ago
Posted in : JSP-Servlet


Hello everyone i am beginner in java and i am working on my major project

I want to generate bill number and employee number like SCS-0001 and so on and bill number like SCS/'date''month'/001............ ie "SCS/0802/001"........ and so on in jsp or servlet and database is mysql... .. Please help ...


Advertisement
View Answers

February 9, 2013 at 3:09 PM


hi friend,

You can create a table as follows :

CREATE TABLE `employee` ( 
`tag_id` char(3) NOT NULL, 
`serial_id` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT, 
`dd` int(2) unsigned zerofill DEFAULT NULL, 
`mm` int(2) unsigned zerofill DEFAULT NULL, 
PRIMARY KEY (`tag_id`,`serial_id`), 
UNIQUE KEY `serial_id` (`serial_id`) 
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1

And insert some records into the columns as follows :

insert into employee(tagid,serialid,dd,mm) values ( 'SCS','001','08','02')

insert into employee(tagid,serialid,dd,mm) values ( 'SCS','002','09','02')

And to display in specific format you can use the concat() method as follows :

SELECT CONCAT(tagid,'-',serialid) as employeenumber FROM employee;

SELECT CONCAT(tagid,'/',dd,mm,'/',serialid) as billnumber FROM employee;

For detail tutorial please go through the following link

MySQL Generate AlphaNumberic Id In JSP



February 9, 2013 at 8:25 PM


Not working actually null pointer exception .........



February 9, 2013 at 8:26 PM


is it auto generate the id ?? or we should insert the value int it ??



February 11, 2013 at 6:08 PM


hi friend,

It would be required to insert the value in the database table except the auto increment field. As shown in the tutorial or if your problem still persist you can send your full code we will try to solve it

Thanks.



February 11, 2013 at 6:10 PM


hi friend,

check your database table, possibly you didn't inserted the value into the table



Related Tutorials/Questions & Answers:
Generate Employee ID (SCS-0001,SCS-0002......)
Generate Employee ID (SCS-0001,SCS-0002......)  Hello everyone i am beginner in java and i am working on my major project I want to generate bill number and employee number like SCS-0001 and so on and bill number like SCS/'date
generate ID
generate ID   Statement st1=con.createStatement(); String sql="insert into employee values(emp_seq.nextval,'"+ename+"','"+eadd+"','"+ephone+"','"+email+"','"+department+"',"+Integer.parseInt(ebpay)+",20,0)"; st1.executeUpdate
Advertisements
Auto Generated Employee ID
Auto Generated Employee ID  Hello Everyone I want to generate an ID like (SCS-0001) and then it should be auto incremented each time a new employee add page is opens. I am using My Sql database
need to generate ID
need to generate ID  hai, i need to generate ID i.e when i select addemploye option and submit, it should generate a emp ID which is 1 greater than the previous highest ID value stored in database. eg: if the higest value
need to generate ID
need to generate ID  hai, i need to generate ID i.e when i select addemploye option and submit, it should generate a emp ID which is 1 greater than the previous highest ID value stored in database. eg: if the higest value
store the employee ID,name,login time and logout time of the employee in database
store the employee ID,name,login time and logout time of the employee in database  hello...I want to store the employee ID,name,login time and logout time of the employee along with the time difference between these two
get details of employee after enter the emp_id
get details of employee after enter the emp_id  how to get employee details after entered the emp_id from database after that we have three more option add new,modify and delet employee   Please visit the following
get details of employee after enter the emp_id
get details of employee after enter the emp_id  how to get employee details after entered the emp_id from database after that we have three more option add new,modify and delet employee   Please visit the following
how to auto generate number in jsp with the database connection mysql for employee number?
how to auto generate number in jsp with the database connection mysql for employee number?  how to auto generate number in jsp with the database connection mysql for employee number?   <%@page import="java.sql.
how to auto generate number in jsp with the database connection mysql for employee number?
how to auto generate number in jsp with the database connection mysql for employee number?  how to auto generate number in jsp with the database connection mysql for employee number?   <%@page import="java.sql.
i need the source code to generate id in jsp
i need the source code to generate id in jsp  hai,i need the source code for generate id...which is i need to generate the new id from the maximum... of generate ids each should have some range...plz give the source code in jsp with ms
the best way to generate a universally unique object ID.
the best way to generate a universally unique object ID.  What is the best way to generate a universally unique object ID? Do I need to use an external resource like a file or database, or can I do it all in memory
Using Hibernate <generator> to generate id incrementally - Struts
Using Hibernate to generate id incrementally  Hi All, How to increment id using Hibernate ( or if any other) to generate id. I am using... to specify the class name to be used to generate the primary key for new record while
MySQL Generate AlphaNumberic Id In JSP
will be as follows : To generate the alpha numeric employee id in MySQL we can...MySQL Generate AlphaNumberic Id In JSP In this section we will discus about how to generate id in specific format in MySQL and JSP. This example explains
id
id  how to find date of birth and gender in id in html with the help of javascript
Employee form
Employee form  In employee form emp Id id after any data iserted is incremented for oher data insertion. insert, delete, update buttons when we cleak the select buttoun then the created table data iserted automaticaly
Adding an employee
Adding an employee  coding for adding an employee
Add Employee
Add Employee  coding for adding an employee
Employee Salaries
Employee Salaries  Define a class Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee... the salary of the Employee to zero. The method getinfo() will return the current
EMPLOYEE - SQL
EMPLOYEE  CALCULATE EMPLOYEE SALARY  Hi friend, Please give the full details of Problem. Thanks
Employee Salaries
Employee Salaries  Define a class Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee... the salary of the Employee to zero. The method getinfo() will return the current
Employee Salaries
Employee Salaries  Define a class Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee... the salary of the Employee to zero. The method getinfo() will return the current
Employee Salaries
Employee Salaries  Define a class Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee... the salary of the Employee to zero. The method getinfo() will return the current
Employee Salaries
Employee Salaries  Define a class Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee... the salary of the Employee to zero. The method getinfo() will return the current
Employee Salaries
Employee Salaries  Define a class Employee with the following properties. Every Employee has a name and a salary. The constructor creates an Employee... the salary of the Employee to zero. The method getinfo() will return the current
employee records
employee records  Pl give one script like i will creat one table name Emp_master and column name like Empcode, Empname. I like one form where I... and one report like details of employee thanks
employee records
employee records  Pl give one script like i will creat one table name Emp_master and column name like Empcode, Empname. I like one form where I... and one report like details of employee thanks
employee records
employee records  Pl give one script like i will creat one table name Emp_master and column name like Empcode, Empname. I like one form where I... and one report like details of employee thanks
application for an Employee
: in this page it should modify employee data and persist in DB 3.DISPLAY
employee progarm
employee progarm  Hai, I have developed a code for an employee program by using jtext fields and buttons,it has no errors but while we are compiling it it is saying that "Exception in thread "main
Employee Management System
Employee Management System  coding for employee management system
 

 

 

DMCA.com