参数顺序错了,就会出错
不过是insert 还是 update
internal static int InsertProducts(TProducts products) { string sql = "insert into [products] ([name],[price],[pricing],[content],[time],[picture]) values (@name,@price,@pricing,@content,@time,@picture)"; OleDbParameter[] parameters = new OleDbParameter[] { AccessHelper.Parameter("@name",products.StrName), AccessHelper.Parameter("@price",products.DecPrice,OleDbType.Numeric), AccessHelper.Parameter("@pricing",products.DecPricing,OleDbType.Numeric), AccessHelper.Parameter("@content",products.StrContent), AccessHelper.Parameter("@time",DateTime.Now,OleDbType.Date), AccessHelper.Parameter("@picture",products.StrPicture) }; int intTemp = AccessHelper.ExecuteNonQuery(sql, parameters); SetSum(); return intTemp; }
AccessHelper.Parameter("@name",products.StrName), AccessHelper.Parameter("@price",products.DecPrice,OleDbType.Numeric), AccessHelper.Parameter("@pricing",products.DecPricing,OleDbType.Numeric), AccessHelper.Parameter("@content",products.StrContent), AccessHelper.Parameter("@time",DateTime.Now,OleDbType.Date), AccessHelper.Parameter("@picture",products.StrPicture)
参数顺序错了,就会出错
不过是insert 还是 update