ResultSet rs = stmt.executeQuery("select name,health,love,strain from dog where name='美美'");
不能改成如下形式。
ResultSet rs = stmt.executeQuery("select name,health,love,strain from dog where name=?");
因为Statement类不能用?占位符,只有preparedStatement才能用?占位符。
ResultSet rs = stmt.executeQuery("select name,health,love,strain from dog where name='美美'");
不能改成如下形式。
ResultSet rs = stmt.executeQuery("select name,health,love,strain from dog where name=?");
因为Statement类不能用?占位符,只有preparedStatement才能用?占位符。