⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatefkp.java

📁 java操作excel数据批量导入
💻 JAVA
字号:
/*
 * Created on 2004-6-6
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com;
/**
 * @author Administrator
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
import java.sql.*;

import com.jstrd.util.*;

public class UpdateFKP {
  public boolean updateFKP(String dwbh, long fkpbh, int kpxz,DBConnection db)
		throws Exception {
        String kpbName = "gd_kpb_"+dwbh;
        double k_yz = 0.0;
        double k_jz = 0.0;
        double k_ljzj = 0.0;
        double k_yzje = 0.0;
        double k_jcz = 0.0;
        double k_ljjz = 0.0;
		String sql = " select sum(kpb.k_yz) as yz,sum(kpb.k_jz) as jz ,sum(k_ljzj) as ljzj,"
				+ "  sum(kpb.k_yzje) as yzje,sum(kpb.k_jcz) as jcz,sum(kpb.k_ljjz) as ljjz "
				+ " from "
				+ kpbName
				+ " kpb"
				+ " where kpb.k_fkpbh ="
				+ fkpbh
				+ " and kpb.k_fz = 2 and kpb.k_kpxz = "
				+ kpxz
				+ " and kpb.k_zczt!=-1 "
				+ " and kpb.k_shf=1 "
				+ " and kpb.k_dwbh='"+dwbh+"'";
		try {
			ResultSet rs = db.executeQuery(sql);
			if(rs.next()) {
				k_yz = rs.getDouble("yz");
				k_jz = rs.getDouble("jz");
				k_ljzj = rs.getDouble("ljzj");
				k_yzje = rs.getDouble("yzje");
				k_jcz = rs.getDouble("jcz");
				k_ljjz = rs.getDouble("ljjz");
			}
		} catch (Exception e) {
			throw new Exception(e.getMessage());
		}
		sql =
			" Update "
				+ kpbName
				+ " set k_yz = "+k_yz+" ,k_jz = "+k_jz+" ,k_ljzj = "+k_ljzj+" ,"
				+ " k_yzje = "+k_yzje+", k_jcz = "+k_jcz+" ,k_ljjz = "+k_ljjz
				+ " where k_kpbh="
				+ fkpbh
				+ " and k_kpxz="
				+ kpxz
				+ " and k_dwbh='"+dwbh+"'";
		try {
			db.executeUpdate(sql);
		} catch (Exception e) {
			throw new Exception(e.getMessage());
		}
		return true;
	}
}

⌨️ 快捷键说明

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