首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

jsp 大神见教

2012-08-09 
jsp 大神指教public boolean modify_user_info(){this.datenew Date().toLocaleString()this.strsqlup

jsp 大神指教
public boolean modify_user_info()
{
this.date=new Date().toLocaleString();
this.strsql="update user_info set ";
this.strsql=this.strsql+"sex="+"''"+this.sex+"',";
this.strsql=this.strsql+"sign="+"''"+this.sign+"',";
this.strsql=this.strsql+"email="+"''"+this.email+"',";
this.strsql=this.strsql+"date="+"'"+this.date+"'";
this.strsql=this.strsql+"where use_id=' "+this.user_id+"'";
boolean isUpdate=super.update(this.strsql);
return isUpdate;
}
public boolean modify_password( )
{
this.strsql="update user_info set";
this.strsql=this.strsql+"password='"+this.password+"'";
this.strsql=this.strsql+"where user_id="+this.user_id;
boolean upsd=super.update(this.strsql);
return upsd;
}
麻烦各位给看看这两段代码哪里错了,老写不进数据库啊!!

[解决办法]
你能不能用stringBuffer的说
[解决办法]
不进数据库?
 你断点 得到完整语句 测试看哪里出错不就知道了吗?
[解决办法]
this.strsql=this.strsql+"sex="+"''"+this.sex+"',";
为什么不改成
this.strsql=this.strsql+"sex='"+this.sex+"',";
再者,实在想传Sql语句的话建议用StringBuffer追加,不然,你可以用占位符,那样多直观
[解决办法]
如果strsql是string类型
可以用
this.strsql+="update user_info set ";
http://www.zhjie.net
[解决办法]
检查一下,strsql语句有点问题
[解决办法]
sql语句拼错了,建议用StringBuffer或StringBuilder。
[解决办法]
貌似你拼接的sql,有些地方没有加空格啊,成了
update user_info set set password=‘password’where 这里貌似没有空格。
建议每行拼接的开头和结尾都加上空格(变量的拼接应在单引号后面加)。
还有,这种方式入土都很多年了,还是从ssh看起吧。
[解决办法]
打印一下strsql,看语句格式及语法是否有误。

热点排行