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

Ads