一个网上购书系统

源代码在线查看: checkout.jsp

软件大小: 573 K
上传用户: babydog00
关键词:
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				
				
				网上书店
				
				
				
				 
									Vector buylist = (Vector)session.getValue("shopcar");
					if(buylist==null||buylist.size()						{
				%>
					
									String userid = (String)session.getValue("userid");
					float pricenum =0;
					for(int i=0;i						{
							Book book = (Book)buylist.elementAt(i);
							pricenum = pricenum + book.getBuynum()*book.getPrice();
						}
					
					DBSQLManager dbsm = new DBSQLManager();
					String sql="INSERT INTO myorder(USER_ID, PRICE_NUM, ORDER_DATE) VALUES('"+userid+"',"+pricenum+",'"+_dateString+"')";
					dbsm.setSqlStr(sql);
					dbsm.executeUpdate();
					dbsm.close();  
					
					DBSQLManager dbsm_ = new DBSQLManager();
					String sql_="SELECT ORDER_ID FROM myorder WHERE USER_ID='"+userid+"' AND ORDER_DATE='"+_dateString+"'";
					dbsm_.setSqlStr(sql_);
					dbsm_.executeQuery();
					ResultSet rs_=dbsm_.getRs();
					rs_.next();
					String orderid = rs_.getString("ORDER_ID");
					dbsm_.close();  
					
					for(int j=0; j					{
						Book book = (Book)buylist.elementAt(j);
						DBSQLManager _dbsm = new DBSQLManager();
						String _sql="INSERT INTO orderitem(ORDER_ID, ISBN, BOOK_NUM) VALUES('"+orderid+"','"+book.getIsbn()+"','"+book.getBuynum()+"')";
						_dbsm.setSqlStr(_sql);
						_dbsm.executeUpdate();
						_dbsm.close();  
					}		
				%>
				谢谢您购买!
				  
				
				
							

相关资源