protected void insertorderinfo(int orderid)
    {
        int orderidtemp = orderid;
        int productidtemp=0;
        int productnumbertemp = 0;
        int pricebuytemp = 0;
        int subtotaltemp = 0;
        string connstring = ConfigurationManager.ConnectionStrings["teaConnectionString"].ConnectionString;
        string sqlstring = "insert into [orderinfo](orderid,productid,productnumber,pricebuy,subtotal) values('" + orderidtemp + "','" + productidtemp + "','" + productnumbertemp + "','" + pricebuytemp + "','" + subtotaltemp + "')";
        SqlConnection Myconn = new SqlConnection(connstring);
        SqlCommand Mycomm = new SqlCommand(sqlstring, Myconn);
        DataTable dt = (DataTable)Session["shopbox"];
        try
        {
            Myconn.Open();
            foreach (DataRow dr in dt.Rows)
            {
                productidtemp =(int) dr["productid"];
                productnumbertemp = (int)dr["productnumber"];
                pricebuytemp = (int)dr["pricebuy"];
                subtotaltemp = (int)dr["subtotal"];
                Mycomm.ExecuteNonQuery();
            }
            Myconn.Close();
        }
        catch
        {
            Response.Write("出错了");
        }
       
    }
写入表后  productid productnumber pricebuy subtotal的值都为0
这个问题值得研究研究

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-01-28
  • 2021-08-30
猜你喜欢
  • 2021-10-24
  • 2022-02-06
  • 2021-11-21
  • 2021-08-25
  • 2021-07-16
  • 2022-12-23
相关资源
相似解决方案