string strSql = string.Format("insert into Special_Order (SpecialProduct_Name,SpecialProduct_Pricet,SpecialProduct_BuyQuantity,SpecialProduct_TotalPrice,SpecialProduct_Time,username,id,SpeciaProduct_ID) values ({0},{1},'{2}','{3}','{4}','{5}','{6}','{7}',1);", count, float.Parse(price) * int.Parse(count), DateTime.Now.ToString(), Session["SpecialOrder_ID"]);索引(从零开始)必须大于或等于零,且小于参数列表的大小。请问哪儿错了
string strSql = string.Format("insert into Special_Order (SpecialProduct_Name,SpecialProduct_Pricet,SpecialProduct_BuyQuantity,SpecialProduct_TotalPrice,SpecialProduct_Time,username,id,SpeciaProduct_ID) values ({0},{1},'{2}','{3}','{4}','{5}','{6}','{7}',1);", 1, 2, 3,4,5,6,7,8 );
还有你的count, float.Parse(price) * int.Parse(count), DateTime.Now.ToString(), Session["SpecialOrder_ID"],这些值给的不够,你要插入的是8个值,但是你这里确实4个。
都测试下吧!
个数必须对应,类型最好也对应