String sql = "update books set bookName='" + bookName + "',ISBN='"
+ ISBN + "',publisher='" + publisher + "',author='" + author
+ "' where id="+id;--------------------------------------------------------------------------------------------------------------
以上代码 出去id外 其他全是字符string类型的字段 如果id没出现在where句中 而出现在set~到where之间的句子当中 那么这个句子该如何写?? 求高人!!
+ ISBN + "',publisher='" + publisher + "',author='" + author
+ "' where id="+id;--------------------------------------------------------------------------------------------------------------
以上代码 出去id外 其他全是字符string类型的字段 如果id没出现在where句中 而出现在set~到where之间的句子当中 那么这个句子该如何写?? 求高人!!
解决方案 »
- 有了struts为什么还要spring
- AJAX的XMLHTTPRequest对象可以传LIST么。AJAX怎么配合JSTL
- 本人毕业设计的宾馆入住管理系统,请大家给点意见,谢谢
- 文件上传时,输入表单值,提交处理,报错后,返回到原来页面,怎么保存文件域的値,不再重新选择上传文件,谢谢.
- Struts 制作静态新闻列表
- 请问,这个.jsp里的内容是什么意思呢?
- 主何网页一打开就自动关闭IE?
- jsp做上傳
- -----急急急!基础问题,各位应该可以解答!------
- sco unix +aphace+jsp 如何配置?
- 按姓名搜索的数据显示在文本框中怎么显示不了 帮忙解决一下 谢了
- java 怎么设置页边距
http://topic.csdn.net/u/20110610/17/fa7cf824-b181-4623-93d1-6ef6c7d4b80f.htmlsql = "update books set id="+oldid+" bookName=..... where id="+newid;
我是说要是换个其他的int型的 如何在set后边添加??、
2:不是主键一样的写呀,但是你用什么做更新条件?String sql = "update books set id = "+id+", bookName='" + bookName + "',ISBN='"
+ ISBN + "',publisher='" + publisher + "',author='" + author
+ "' where ?;
这里你用什么做更新条件,ID不行了,因为你写在了set中间,主键ID是不能更新的,这是数据库的规定!
String sql = "update books set bookName='" + bookName + "',ISBN='"
+ ISBN + "',publisher='" + publisher + "',author='" + author
+ "', number= " + number+ " where id="+id;
String sql = "update books set bookName='" + bookName + "',ISBN='"
+ ISBN + "',publisher='" + publisher + "',author='" + author
+ "' ,id2="+id2" where id="+id;