mysql jdbc PreparedStatement char

2024-12-13 15:50:07
推荐回答(2个)
回答1:

PreparedStatementps = conn.prepareStatement("insert into user values (?,?)");
ps.setObject(1, "zhangsan");
ps.setObject(2,"123");
ps.executeUpdate();

回答2:

PreparedStatementps = conn.prepareStatement("insert into user values (?,?)");
ps.setString(1, "zhangsan");
ps.setString(2,"123");
ps.executeUpdate();