Public Boolean delTb_Stu (String column, String value) {
A Boolean flag=false;
String SQL="delete from tb_stu where '" + column +"'='" + value + "' ";
Conn=db. GetConn ();
Try {
STMT=conn. CreateStatement ();
Int ans=STMT. ExecuteUpdate (SQL);
If (ans> 0 {
Flag=true;
}
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
} the finally {
Db. CloseAll (conn, STMT, rs);
}
return flag;
}
CodePudding user response:
'column is a field, do not need to add the single quotes.String SQL="delete from tb_stu where" + column + "='" + value +"' ";
CodePudding user response:
Learning, learningCodePudding user response:
Sea, but now I also encountered such a problem, it seems to be sinking deeper...