📄 selldetaildaoimpl.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DaFanRongMIS.Model.Common;
namespace DaFanRongMIS.Model.Sell
{
class SellDetailDAOImpl:SellDetailDAO
{
public string AddSellDetail(SellDetailEntity sellDetail)
{
string str = "";
//声明并设置SqlCommand命令
SqlCommand cmdadd = new SqlCommand();
cmdadd.Connection = ConnectionDataBase.getConOpen();
cmdadd.CommandType = CommandType.StoredProcedure;
cmdadd.CommandText = "Add_SellDetail";
//结束声明和设置SqlCommand命令
//参数赋值
SqlParameter MainIDAdd = new SqlParameter("@MainId", SqlDbType.VarChar, 20);
MainIDAdd.Value = sellDetail.MainID;
cmdadd.Parameters.Add(MainIDAdd);
SqlParameter ProductIDAdd = new SqlParameter("@ProductID", SqlDbType.VarChar, 20);
ProductIDAdd.Value = sellDetail.ProductID;
cmdadd.Parameters.Add(ProductIDAdd);
SqlParameter SoldCountAdd = new SqlParameter("@SoldCount", SqlDbType.Decimal);
SoldCountAdd.Value = sellDetail.SoldCount;
cmdadd.Parameters.Add(SoldCountAdd);
//结束参数赋值
//打开库,执行,关闭库
try
{
cmdadd.Connection = Common.ConnectionDataBase.getConOpen();
cmdadd.ExecuteNonQuery();
str = "OK";
}
catch (Exception ee)
{
str = ee.Message;
}
finally
{
Common.ConnectionDataBase.getConClose();
}
//结束打开库,执行,关闭库
return str;
}//end mothed AddSellDetail
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -