public void Insert(Customer item) {
string sql = @"
USE [WXCustomerCard]
GO
INSERT INTO [dbo].[customer_info]
([customer_id]
,[member_id]
,[grade_id]
,[nick_name]
,[name]
,[tel]
,[country]
,[province]
,[city]
,[town]
,[address]
,[postcode]
,[shop_name]
,[modify_date]
,[score]
,[goods_total]
,[trade_count]
,[trade_total]
,[back_count]
,[balance]
,[usedscore]
,[allowusescore]
,[arrearagevalue]
,[email]
,[birthday])
VALUES
(@Customer_id
,@Member_id
,@Grade_id
,@Nick_name
,@Name
,@Tel
,@Country
,@Province
,@City
,@Town
,@Address
,@Postcode
,@Shop_name
,@Modify_date
,@Score
,@Goods_total
,@Trade_count
,@Trade_total
,@Back_count
,@Balance
,@Usedscore
,@Allowusescore
,@Arrearagevalue
,@Email
,@Birthday)
";
List<DbParameter> ps = new List<DbParameter>(){
new SqlParameter("@Customer_id",item.Customer_id),
new SqlParameter("@Member_id",item.Member_id),
new SqlParameter("@Grade_id",item.Grade_id),
new SqlParameter("@Nick_name",item.Nick_name),
new SqlParameter("@Name",item.Name),
new SqlParameter("@Tel",item.Tel),
new SqlParameter("@Country",item.Country),
new SqlParameter("@Province",item.Province),
new SqlParameter("@City",item.City),
new SqlParameter("@Town",item.Town),
new SqlParameter("@Address",item.Address),
new SqlParameter("@Postcode",item.Postcode),
new SqlParameter("@Shop_name",item.Shop_name),
new SqlParameter("@Modify_date",item.Modify_date),
new SqlParameter("@Score",item.Score),
new SqlParameter("@Goods_total",item.Goods_total),
new SqlParameter("@Trade_count",item.Trade_count),
new SqlParameter("@Trade_total",item.Trade_total),
new SqlParameter("@Back_count",item.Back_count),
new SqlParameter("@Balance",item.Balance),
new SqlParameter("@Usedscore",item.Usedscore),
new SqlParameter("@Allowusescore",item.Allowusescore),
new SqlParameter("@Arrearagevalue",item.Arrearagevalue),
new SqlParameter("@Email",item.Email),
new SqlParameter("@Birthday",item.Birthday),
new SqlParameter("@OpenId",item.OpenId)
};
db.ExecuteNonQuery(sql, ps);
}
转载于:https://www.cnblogs.com/xielideboke/p/7283780.html