<%@page import="com.dryclean.web.controller.DBUtil"%> <%@page import="java.sql.ResultSet"%> <%@page import="java.sql.Statement"%> <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.Connection"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <% /*AdduserBeans addCust_obj=new AdduserBeans(); addCust_obj.setCustomer_fname(request.getParameter("add_customer_fname")); addCust_obj.setCustomer_lname(request.getParameter("add_customer_lname")); addCust_obj.setCustomer_address(request.getParameter("add_customer_cellnumber")); addCust_obj.setCustomer_cellnumber(request.getParameter("add_customer_address")); */ //DBUtil.SaveCustomer(addCust_obj); //System.out.println(adduser.getCustomer_fname()); /*String dbUrl = "jdbc:mysql://localhost:3306/"; String db = "dry_cleaner"; String driver = "com.mysql.jdbc.Driver"; String user = "root"; String pass = "";*/ Connection con =null; Statement stmt = null; int updateQuery=0; String query="INSERT INTO customers (customer_id, first_name,last_name,contact,address) VALUES('null','"+request.getParameter("add_customer_fname")+"','"+request.getParameter("add_customer_lname")+"','"+request.getParameter("add_customer_cellnumber")+"','"+request.getParameter("add_customer_address")+"')"; try{ con = DBUtil.getConnection("jdbc:mysql://localhost:3306/","dry_cleaner","com.mysql.jdbc.Driver","root",""); //Class.forName(driver); //con = DriverManager.getConnection (dbUrl+db,user,pass); System.out.println("connection success fully"); }catch(Exception ex){ System.out.println("Connection error"); } try{ updateQuery=stmt.executeUpdate(query); if (updateQuery != 0) { System.out.println("table is created successfully and " + updateQuery + " row is inserted."); } //stmt = con.createStatement(); //stmt.executeUpdate(query); /* QueryString = "INSERT INTO user_master1(User_Name,UserId,User_Pwd) VALUES ('Mahendra',"+ "'mahendra25','1213456')"; updateQuery = statement.executeUpdate(QueryString); if (updateQuery != 0) { System.out.println("table is created successfully and " + updateQuery + " row is inserted."); */ /*if(stmt.executeUpdate(query)>0){ System.out.print("Records inserted"); }else{ System.out.print("insertion faild"); }*/ }catch(Exception ex){ System.out.println("Query :"+query); //throw new Exception("Query Error"); } response.sendRedirect("user_page.jsp"); %>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)