日期:2014-05-17  浏览次数:20736 次

sql 语句的问题 求大神 指点
String sio = (String) ServletActionContext.getRequest().getSession()
.getAttribute("uname");
System.out.println(sio);
String sql = "update student set stupassword='" + t2 + ",stupapers='" + t3+ "' where stuname='" + sio + "'";
Jdbc jdbc = new Jdbc();
Connection connection = jdbc.run();
Statement statement = connection.createStatement();
statement.executeQuery(sql);

t2  t3  sio   三个值都可以取到



  在MyEclipse中运行的时候报这个错误    java.sql.SQLException: ORA-00933: SQL 命令未正确结束    
   但是我把它在PLSQL  中 运行 有没有报错    
这是为什么啊  ???????? 

------解决方案--------------------
 "update student set stupassword='" + t2 + "

T2后面少一个单引号
------解决方案--------------------
建议用 prepareStatement
------解决方案--------------------
在SQL字符串加上一个断点。看看。拼接字符串出的问题。