java.sql.SQLException: 第 1 行: ';' 附近有语法错误......怎么解?
publicstaticvoidzongkuotermid(){Zongkuochulic=newZongkuochuli();con=c.getConnection()...
public static void zongkuotermid() {
Zongkuochuli c = new Zongkuochuli();
con = c.getConnection();
try {
sql = con.createStatement();
sql.executeUpdate("update csnlibrary.dbo.allInclusive set enterDate = LEFT((SELECT MIN(code) FROM csneschool.dbo.term), 4) + '-09-01' "
+ " WHERE (CONVERT(varchar(10), enterDate, 120) < (LEFT ((SELECT MIN(code) FROM csneschool.dbo.term), 4) + '-09-01');");
} catch (SQLException e) {
e.printStackTrace();
}
}
static Connection con; // 声明Connection对象
static Statement sql; // 声明Statement对象
static ResultSet res; // 声明ResultSet对象
// static int b1;
public Connection getConnection() { // 连接数据库方法
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:jtds:sqlserver://127.0.0.1:1433/baite2008", "sa",
"0000");
} catch (Exception e) {
e.printStackTrace();
}
return con; // 返回Connection对象
} 展开
Zongkuochuli c = new Zongkuochuli();
con = c.getConnection();
try {
sql = con.createStatement();
sql.executeUpdate("update csnlibrary.dbo.allInclusive set enterDate = LEFT((SELECT MIN(code) FROM csneschool.dbo.term), 4) + '-09-01' "
+ " WHERE (CONVERT(varchar(10), enterDate, 120) < (LEFT ((SELECT MIN(code) FROM csneschool.dbo.term), 4) + '-09-01');");
} catch (SQLException e) {
e.printStackTrace();
}
}
static Connection con; // 声明Connection对象
static Statement sql; // 声明Statement对象
static ResultSet res; // 声明ResultSet对象
// static int b1;
public Connection getConnection() { // 连接数据库方法
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:jtds:sqlserver://127.0.0.1:1433/baite2008", "sa",
"0000");
} catch (Exception e) {
e.printStackTrace();
}
return con; // 返回Connection对象
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
2个回答
展开全部
把;直接去了,你是不是用了中文的分号,但是你的卸载字符串里面的,所以编译没有报错
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询