glzhprocess.java

来自「此社区管理系统是我们实习期间做的一个项目」· Java 代码 · 共 107 行

JAVA
107
字号
package community.zhgl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import community.*;

public class glzhprocess {
	
	public glzhprocess(){
		
	}
	
	public boolean update(zhglbean bean){
		String sql = "update yhzlb set hzname=?,sex=?,homephone=?,mobile=?,company=?,workphone=?,workaddr=? where hzno='"+bean.getHzno()+"'";

		Connection con = DBConnectionManager.getConnection();

		PreparedStatement pstmt = null;
		int count = 0;
		try {
			pstmt = con.prepareStatement(sql);
			pstmt.setString(1, bean.getHzname());
			pstmt.setString(2, bean.getSex());
			pstmt.setString(3, bean.getHomephone());
			pstmt.setString(4, bean.getMobile());
			pstmt.setString(5, bean.getCompany());
			pstmt.setString(6, bean.getWorkphone());
			pstmt.setString(7, bean.getWorkaddr());
			count = pstmt.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			dbutil.close(pstmt);
			dbutil.close(con);
		}
		if(count<1)return false;
		return true;
	}
	public boolean deletehz(String hzno){
		String sql = "delete from yhzlb where hzno='"+hzno+"'";

		Connection con = DBConnectionManager.getConnection();

		PreparedStatement pstmt = null;
		int count = 0;
		try {
			pstmt = con.prepareStatement(sql);
			count = pstmt.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			dbutil.close(pstmt);
			dbutil.close(con);
		}
		if(count<1)return false;
		return true;
	}
	public boolean deletecy(String jtcyno){
		String jtcy=jtcyno;
		String sql = "delete from jtcyb where jtcyno='"+jtcy+"'";

		Connection con = DBConnectionManager.getConnection();

		PreparedStatement pstmt = null;
		int count = 0;
		try {
			pstmt = con.prepareStatement(sql);
			count = pstmt.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			dbutil.close(pstmt);
			dbutil.close(con);
		}
		if(count<1)return false;
		return true;
	}
	public boolean fyupdate(zhglbean bean){
		
		String sql = "update jfglb set scuse=?,bcuse=?,yjmoney=?,sqdate=?,sqperson=?,ffkind=?,jfstate=? where hzno='"+bean.getHzno()+"' and jftype='"+bean.getJftype() +"'";
		
		Connection con = DBConnectionManager.getConnection();

		PreparedStatement pstmt = null;
		int count = 0;
		try {
			pstmt = con.prepareStatement(sql);
			pstmt.setString(1, bean.getScuse());
			pstmt.setString(2, bean.getBcuse());
			pstmt.setString(3, bean.getYjmoney());
			pstmt.setString(4, bean.getSqdate());
			pstmt.setString(5, bean.getSqperson());
			pstmt.setString(6, bean.getFfkind());
			pstmt.setString(7, bean.getJfstate());
			count = pstmt.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			dbutil.close(pstmt);
			dbutil.close(con);
		}
		if(count<1)return false;
		return true;
	}
}

⌨️ 快捷键说明

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