<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or g/TR/html4/loose.dtd"> <%! Connection con =null; ResultSet rs; PreparedStatement psnt; %><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert a new user</title> </head> <body> <% //loading the drivers Class.forName("net.sourceforge.jtds.jdbc.Driver"); //Initailizing the connection object con =DriverManager.getConnection("jdbc:jtds:sqlserver://Traina:1433/varun","sa", "trNg*"); //get the values from the previous page String empn=request.getParameter("empN"); String empid1=request.getParameter("usrid"); String pass=request.getParameter("pas"); String usrtp=request.getParameter("usrtp"); System.out.println(empn); System.out.println(empid1); System.out.println(pass); System.out.println(usrtp); //then preparing the statement for inserting the values into the table psnt=con.prepareStatement("INSERT empVar VALUES(?,?,?,?)"); //psnt=con.prepareStatement("INSERT INTO empVar VALUES (empId=?,empName=?,passwo rd=?,userType=?)"); psnt.setString(1,empn); psnt.setString(2,empid1); psnt.setString(3,pass); psnt.setString(4,usrtp); //Executing the query psnt.executeUpdate(); %> </body> </html>