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 ...
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
Not working actually null pointer exception .........
is it auto generate the id ?? or we should insert the value int it ??
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
check your database table, possibly you didn't inserted the value into the table