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......)
connection to mysql in jsp
how to generate bank account number?
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?
Database connectivity Hibernate mysql connection.
connection of jsp with mysql - JSP-Servlet
How to retrieve image from mysql database in JSP?
How to generate random number in java
How do I generate random number?
connection with database - 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 of jsp with mysql - JSP-Servlet
Auto Generated Employee ID
MySQL Auto_Increment
jsp/mysql connection
jsp/mysql connection
JSP - MySQL - Connection
connection with MySQL to java.
database connection
how to display image and text in single jsp page from the mysql database
Generate Random Numbers
Retrieve image from mysql database through jsp
server database connection - JSP-Servlet
Draw graph using jsp without database connection
How to save form fields into the MySql Database without submit button in jsp?
how to upload an image from a jsp page to a mysql database table using jsp
connection with mysql with jstl - JSP-Servlet
PHP Mysql Database Connection
how to generate timetable - JSP-Servlet
Backup MySQL Database - JSP-Servlet
How to auto increment primary key in mysql...
Establish a Connection with MySQL Database
How to connect to MySQL in JSP?
JSP Login Form with MySQL Database Connection and back end validation
jQuery auto complete through database using 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

Ads