求帮忙看下,为啥怎么都对的就是说有SQL语法错误呢?
Class.forName("com.mysql.jdbc.Driver");conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "03122049");
//String sqlstr = "select * from student where id>?";
// String name="何神";
String sqlstr = "insert into student (id,name,age,time) values (?,?,?,?);
// (9,'" + name + "',25,now())";
ps = conn.prepareStatement(sqlstr);
//ps.setInt(1, 2);
ps.setObject(1, "10");
ps.setObject(2, "hfg");
ps.setInt(3, 20);
ps.setDate(4, new java.sql.Date(System.currentTimeMillis()));
// set = ps.executeQuery();