作者:乔山办公网日期:
返回目录:excel表格制作
第一,你确定你的文件时EXCEL,而不是什么CSV
第二,用POI包,只要位置确定,一定能够读到。
public class Update1 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:tt", "sa", "www");
String sq="delete from t1 where userName=?";
PreparedStatement ps = con.prepareStatement(sq);
ps.setString(1, "cct");
int t = ps.executeUpdate();
if (t > 0) {
System.out.println("ok");
} else {
System.out.println("false");
}
ps.close();
con.close();
}
}
tt为数据库的名称,www是数据库登陆时的密码e69da5e887aae79fa5e98193333,删除成功就会输出ok
:删除记录的命令格式: DELETE FROM 表名 WHERE <条件> 如果省略where,则删除所有记录,如果指定where,则删除指定满足条件的记录
apache 的POI的sheet对象有remove(row)这个方法。