网上商品销售的代码,包含数据库 //当购买商品时,获取商品信息 public OrderItem GetSubGoodsInformation(DataListCommandEventArgs e, DataList DLName) { //获取购物车中的信息 OrderItem Goods = new OrderItem(); Goods.ID = DLName.DataKeys[e.Item.ItemIndex].ToString(); string GoodsInfo = e.CommandArgument.ToString(); Goods.Price = float.Parse(GoodsInfo); return (Goods); }