描述:向Access中插入记录,代码如下:
//将数据插入Access
private int addData(List dateListForDownload, String fileUrl) throws Exception{
int rowcount = 0;
Connection con = null;
PreparedStatement ps = null;
try{
System.out.println("fileUrl = "+fileUrl);
con = getConnection(fileUrl);
con.setAutoCommit(false);
ps = con.prepareStatement("INSERT INTO price values(?, ?, ?, ?, ?, ?, ? ,?, ?, ?, ?, ?)");
for (SummaryPriceInfo object : dateListForDownload) {
ps.setString(1, (rowcount + 1) +"");
ps.setString(2, StringUtil.formatNullToEmpty(object.getRealname()));
ps.setString(3, StringUtil.formatNullToEmpty(object.getOscym()));
ps.setString(4, StringUtil.formatNullToEmpty(object.getOrgname()));
ps.setString(5, StringUtil.formatNullToEmp