阅读背景:

C# ACCESS 参数化SQL语句出错汇总

来源:互联网 
参数顺序错了,就会出错
不过是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;
        }
inter



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: