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之间的句子当中 那么这个句子该如何写?? 求高人!!
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;