当前位置: 技术问答>java相关
在jsp中如何写sql查询?
来源: 互联网 发布时间:2015-01-20
本文导语: 我要将userid,password作为查询条件在jsp中应该如何写,是这样吗: String Userid=request.getParameter("userid"); String Password=request.getParameter("password"); ... rs_user=state.executeQuery("select * from userInfo where user_i...
我要将userid,password作为查询条件在jsp中应该如何写,是这样吗:
String Userid=request.getParameter("userid");
String Password=request.getParameter("password");
...
rs_user=state.executeQuery("select * from userInfo where user_id=Userid and password=Password order by user_id")
我知道不对啦,我想要个正确答案
String Userid=request.getParameter("userid");
String Password=request.getParameter("password");
...
rs_user=state.executeQuery("select * from userInfo where user_id=Userid and password=Password order by user_id")
我知道不对啦,我想要个正确答案
|
String sql="select * from userInfo where user_id='"+Userid+"'and password='"+
Password+"'";
(order by 不用啦)
rs_user=state.executeQuery(sql);
Password+"'";
(order by 不用啦)
rs_user=state.executeQuery(sql);
|
String sql="select * from userInfo where user_id="+'"'+Userid+'"'+ " and password="+'"'+Password+'"';
rs_user=state.executeQuery(sql);
rs_user=state.executeQuery(sql);