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;
}
}