日期:2014-05-18 浏览次数:20443 次
insert into OD (orderno,bookno,bname,sl,totalprice,allprice) 你要插入6個字段 而你只 select bookno,bname,sl,totalprice from MC where userid=session["userid"] and orderconfirm='0' 4個對應值 orderno 和allprice漏掉了 try insert into OD (orderno,bookno,bname,sl,totalprice,allprice) select orderno,bookno,bname,sl,totalprice, allprice from MC where userid=session["userid"] and orderconfirm='0'
------解决方案--------------------
string sql="insert into OD (orderno,bookno,bname,sl,totalprice,allprice) "
+ "select " + session["orderno"].toString() + " bookno,bname,sl,totalprice from MC where userid='" + session["userid"].tostring() +"' and orderconfirm='0'";