java.sql.PreparedStatement p=con.prepareStatement(\"select * from users where use_name=);为什么会出错
原问题:java.sql.PreparedStatement p=con.prepareStatement(\"select * from users where use_name=);为什么会出错
分类:编程开发 > 最后更新时间:【2017-01-06 02:50:44】
分类:编程开发 > 最后更新时间:【2017-01-06 02:50:44】
最佳答案
con.prepareStatement()里面参数是String类型的sql语句,在这个语句中你所有的变量需要使用"?"做占位符就像 “where use_name=?”,然后跟据变量的类型进行设置,用String为例,p.setString(参数1,参数2),参数1是第几个占位符"?",占位符从1开始写,参数2是想要填充的值。
最佳答案由网友 破马张飞奔你家 提供
其他回答
其它网友回答:
好牛逼的语句,前面加字符串前面的双引号还有个斜杠,脑抽啊你,而且后面居然没有双引号,这就有点脑残了.
其它网友回答:
PreparedStatement需要参数