Connection con=DataConnection.getconn();
String saveQuery;
saveQuery = "insert into user1 values (null, ?, ?, ?, ?, ?)";
PreparedStatement Stmt = DataConnection.prepare(con, saveQuery);
Stmt.setString(1,username);
Stmt.setString(2,password);
Stmt.setString(3,phone);
Stmt.setString(4,addr);
Stmt.setTimestamp(5, new Timestamp(rdate.getTime())); Stmt.execute( "Set IDENTITY_INSERT user1 ON " ) ; Stmt.executeUpdate(); //这是第73行
Stmt.execute( "Set IDENTITY_INSERT user1 OFF " ) ;下面是错误信息:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid call Statement method: {0}
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
at User.User.save(User.java:73)
String saveQuery;
saveQuery = "insert into user1 values (null, ?, ?, ?, ?, ?)";
PreparedStatement Stmt = DataConnection.prepare(con, saveQuery);
Stmt.setString(1,username);
Stmt.setString(2,password);
Stmt.setString(3,phone);
Stmt.setString(4,addr);
Stmt.setTimestamp(5, new Timestamp(rdate.getTime())); Stmt.execute( "Set IDENTITY_INSERT user1 ON " ) ; Stmt.executeUpdate(); //这是第73行
Stmt.execute( "Set IDENTITY_INSERT user1 OFF " ) ;下面是错误信息:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid call Statement method: {0}
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
at User.User.save(User.java:73)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货