String sql1 = null;
String password2;
password2 = b1.getText ();
ResultSet rs = null;
Statement stmt = null;
sql1 = "update user_id set password = 'password2' where id = 1";
SqlManager DBm = SqlManager.createInstance (); / / Get instance of a single -state mode
DBm.connectDB ();
try {
stmt = DBm.Sqlstmt;
rs = stmt.executeQuery (sql1);
} catch (SQLException e1) {
e1.printStackTrace ();
}
code into the prompt : This statement does not return a result set
------ Solution ---------------------- ----------------------
sql1 = "update user_id set password = '" + password2 "' where id = 1 ";
so write , you try. .
------ For reference only -------------------------------------- -
you write sql update operation is executed , ah, no result set ah. .
Also, perform the operation is stmt.executeUpdate it. . .
------ For reference only ------------------------------------ ---
right, but password2 how to write SQL in it, a direct reference to the error , it becomes a string in quotes password2, the result is not what I from text input.
没有评论:
发表评论