zoukankan      html  css  js  c++  java
  • SubSonic的sql插入

     public bool savebtn(string companyName, string contactName, string phone, string email, DateTime saleDate, string number, string brief, string goods, Decimal quotation, string seller, string handler)
            {
                //////DAL.Sale.Insert(seller, handler, brief, goods);//事务处理还是昨天的那个错误,直接插入是正确的!
                //QueryCommandCollection coll = new QueryCommandCollection();
                //QueryCommand insert = new QueryCommand("insert sales(companyName,contactName,phone,email,saleDate,number,quotation,brief, goods,seller,handler) values(@companyName,@contactName,@phone,@email,@saleDate,@number,@quotation,@brief,@goods,@seller,@handler)");

                //insert.Parameters.Add("@companyName", companyName);
                //insert.Parameters.Add("@contactName", contactName);
                //insert.Parameters.Add("@phone", phone);
                //insert.Parameters.Add("@email", email);

                //insert.Parameters.Add("@saleDate", saleDate);
                //insert.Parameters.Add("@number", number);
                //insert.Parameters.Add("@quotation", quotation);


                //insert.Parameters.Add("@brief", brief);
                //insert.Parameters.Add("@goods", goods);
                //insert.Parameters.Add("@seller", seller);
                //insert.Parameters.Add("@handler", handler);
                //coll.Add(insert);
                //DataService.ExecuteTransaction(coll);
                //return true;


                DAL.Sale insert = new Product.DAL.Sale();
                insert.CompanyName = companyName;
                insert.ContactName = contactName;
                insert.Phone = phone;
                insert.Email = email;
                insert.SaleDate = saleDate;

                insert.Number = number;
                insert.Quotation = quotation;
                insert.Brief = brief;
                insert.Goods = goods;
                insert.Seller = seller;

                insert.Handler = handler;
                try
                {
                    insert.Save();
                    return true;
                }
                catch
                {
                    return false;
                }
             
            }

  • 相关阅读:
    unity IOC 的使用
    Senparc之OAuth原理
    改进的日志记录类
    发一个 Nuget打包发布小工具
    贴一个微信小程序跳一跳辅助
    调用API让声卡发出声音
    控制台彩色输出
    C#调用cmd实现自我删除
    一个适合新手的简易计算器
    简单Console进度条
  • 原文地址:https://www.cnblogs.com/yuanzhengang/p/1043967.html
Copyright © 2011-2022 走看看