zoukankan      html  css  js  c++  java
  • 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;
            }
    

          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
  • 相关阅读:
    Shiro学习
    【工具】流程图软件
    使用python快速搭建web服务器
    接口并发测试
    什么是REST编程
    Linux下查看cpu使用率
    中文价格识别为数字 java代码
    mysql mvcc 的理解
    Nacos client 客户端cpu占用100% 问题排查和解决方案
    springboot 不停服动态更新定时任务时间(转)
  • 原文地址:https://www.cnblogs.com/henw/p/2020376.html
Copyright © 2011-2022 走看看