customerpwdbean.java

来自「网上购物系统」· Java 代码 · 共 73 行

JAVA
73
字号
package Model_Customer;

import DataBase.ConDataBase;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;

public class CustomerPwdBean 
{
  public CustomerPwdBean()
  {
  }

  public String InsertCustomerPwd(CustomerPwd cp)
  {
    Connection con=ConDataBase.getConnection();
    try{
    CallableStatement cmst=con.prepareCall("{call INSERTUSERLOGIN(?,?,?)}");
    cmst.setString(1,cp.getCustomerID());
    cmst.setString(2,cp.getPwd());
    cmst.registerOutParameter(3,Types.VARCHAR);
    
    cmst.execute();
    String re=cmst.getString(3);
    return re;
    }
    catch(Exception e)
    {
      System.out.println(e.getMessage());
      return e.getMessage();
    }
  }

  public String UpdateCustomerPwd(CustomerPwd cp)
  {
    Connection con=ConDataBase.getConnection();
    try{
      CallableStatement cmst=con.prepareCall("{call UPDATECUSTOMERPWD(?,?,?,?)}");
      cmst.setString(1,cp.getCustomerID());
      cmst.setString(2,cp.getPwd());
      cmst.setString(3,cp.getPurview());
      cmst.registerOutParameter(4,Types.VARCHAR);
      
      cmst.execute();
      String re=cmst.getString(4);
      return re;
    }
    catch(Exception e)
    {
      System.out.println(e.getMessage());
      return e.getMessage();
    }
  }

  public String DeleteCustomerPwd(String customerid)
  {
    Connection con=ConDataBase.getConnection();
    try{
    CallableStatement cmst=con.prepareCall("{call DELETECUSTOMERPWD(?,?)}");
    cmst.setString(1,customerid);
    cmst.registerOutParameter(2,Types.VARCHAR);
    
    cmst.execute();
    String re=cmst.getString(2);
    return re;
    }
    catch(Exception e)
    {
      System.out.println(e.getMessage());
      return e.getMessage();
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?