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
MySQL Generate AlphaNumberic Id In JSP
retrive the employee details with image from mysql database using jsp servlet
connection to mysql in jsp
how to generate auto code ?
Generate random number between two numbers in Scala
Generate random number between two numbers in Scala
How to retrieve image from mysql database in JSP?
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
Database connectivity Hibernate mysql connection.
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?
Generate Employee ID (SCS-0001,SCS-0002......)
jsp/mysql connection
jsp/mysql connection
How do I generate random number?
JSP - MySQL - Connection
How to generate random number in 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?
connection with MySQL to java.
how to upload an image from a jsp page to a mysql database table using jsp
How to connect to MySQL in JSP?
Retrieve image from mysql database through jsp
database connection
PHP Mysql Database Connection

Ads