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?

View Answers

March 21, 2012 at 12:04 PM

<%@page import="java.sql.*"%>
<%
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement st = conn.createStatement();
ResultSet rs=st.executeQuery("SELECT id FROM user");
int id=0;
if(rs.last()){
id=rs.getInt("id")+1;
}
st.executeUpdate("insert into user(id,name,address) values("+id+",'rose','delhi')");
out.println("Data is inserted successfully");
}
catch(Exception e){}
%>









Related Tutorials/Questions & Answers:
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?
Advertisements
How to make auto number? - JSP-Servlet
How create auto number? - JSP-Servlet
MySQL Generate AlphaNumberic Id In JSP
retrive the employee details with image from mysql database using jsp servlet
Generate random number between two numbers in Scala
Generate random number between two numbers in Scala
how to generate auto code ?
Generate Employee ID (SCS-0001,SCS-0002......)
how to generate bank account number?
connection to mysql in jsp
how to generate reports from oracle database using jsp and ajax code
How to generate a list of random numbers?
How to generate a list of random numbers?
How to generate a list of random numbers?
How to retrieve image from mysql database in JSP?
Database connectivity Hibernate mysql connection.
How to generate random number in java
How do I generate random number?
connection of jsp with mysql - JSP-Servlet
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide
connection with database - JSP-Servlet
connection of jsp with mysql - JSP-Servlet
Auto Generated Employee ID
MySQL Auto_Increment
jsp/mysql connection
jsp/mysql connection
JSP - MySQL - Connection
how to display image and text in single jsp page from the mysql database
connection with MySQL to java.
How to save form fields into the MySql Database without submit button in jsp?
database connection
how to upload an image from a jsp page to a mysql database table using jsp
how to generate timetable - JSP-Servlet
Generate Random Numbers
Retrieve image from mysql database through jsp
server database connection - JSP-Servlet
Draw graph using jsp without database connection
PHP Mysql Database Connection
connection with mysql with jstl - JSP-Servlet
How to auto increment primary key in mysql...
How to connect to MySQL in JSP?
Establish a Connection with MySQL Database
Backup MySQL Database - JSP-Servlet
Video Tutorial: How to access MySQL database from JSP?
how to generate captcha in jsp page ? - JSP-Servlet
how to store image in folder and stored image path in mysql database using JSP
JSP Login Form with MySQL Database Connection and back end validation

Ads