请问一下 我要删除购物车里的数据要怎么写啊
单纯删除业务 不改变数据库
请高人指点一下 

解决方案 »

  1.   

    你的购物车是用session还是cookie。
    如果是session的话就把数据保存在List<>里面,进行操作
      

  2.   

    if (!IsPostBack)
            {
                List<Amodel> l = new List<Amodel>();
                if (Session["name"] != null)
                {
                    l = (List<Amodel>)Session["name"];
                }                     if (Request.QueryString["id"] != null)
                {
                   
                   aBLL ab = new aBLL();
                   Amodel a = ab.GetTable(Convert.ToInt32(Request.QueryString["id"]));                l.Add(a);
                    Session["name"] = l;
                   
                }
                Rpt.DataSource = l;
                Rpt.DataBind();
                int sum = 0;
                foreach (Amodel am in l)
                {
                    sum += am.IPrice;
                }
                Label2.Text ="总价"+ sum();
            }
      

  3.   

    如果你用
    datatable dt=(datatable)session[]
    dt.删除某一行
      

  4.   


    我用producteSort类写了一下
    根据ID进行删除
             List<ProducteSort> list = null       
            if (Session["name"] != null)
            {
                list = (list<ProducteSort>)Session["name"];
            }        if (Request.QueryString["id"] != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    ProducteSort producte = list[i];
                    if (producte.ID.ToString() == Request.QueryString["id"].ToString())
                    {
                        list.Remove(producte);
                    }
                }
            }
      

  5.   

    直接用函数吧Session重置一下,可以了
      

  6.   

    弱弱的问一句 怎么重置session啊
      

  7.   

    我 购物车  用 cookie 做的。