how to auto generate number in jsp with the database connection mysql for employee number?

Ads
 

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){}
%>

Ads









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
how to generate auto code ?
retrive the employee details with image from mysql database using jsp servlet
MySQL Generate AlphaNumberic Id In JSP
Generate random number between two numbers in Scala
Generate Employee ID (SCS-0001,SCS-0002......)
how to generate bank account number?
How to generate a list of random numbers?
connection to mysql in jsp
Database connectivity Hibernate mysql connection.
how to generate reports from oracle database using jsp and ajax code
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide
How to retrieve image from mysql database in JSP?
Auto Generated Employee ID
How do I generate random number?
How to generate random number in java
connection of jsp with mysql - JSP-Servlet
MySQL Auto_Increment
connection with database - JSP-Servlet
connection of jsp with mysql - JSP-Servlet
jsp/mysql connection
jsp/mysql connection
How to auto increment primary key in mysql...
JSP - MySQL - Connection
connection with MySQL to java.
PHP Mysql Database Connection
how to display image and text in single jsp page from the mysql database

Ads