editRecords.jsp
<%@ page language = "java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import = "java.sql.*"%>
<%@page import="java.util.*"%>
<%
int emp_id = Integer.parseInt(request.getParameter("editID"));
//String sql = "SELECT * FROM EMP_DETAIL WHERE ID= ? ";
Connection con = null;
PreparedStatement psmt = null;
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test_db";
String userName = "root";
String password = "";
ResultSet rs = null;
try {
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url, userName, password);
String sql = "SELECT * FROM EMP_DETAIL WHERE ID='"+emp_id+"'";
psmt = con.prepareStatement(sql);
rs = psmt.executeQuery();
while(rs.next()){
%>
<%
}
}
catch(Exception e){
out.println("Error: " +e);
}
con.close();
psmt.close();
%>
> | Employee ID: > | Employee Name: |
0 comments:
Post a Comment