时间:2021-07-01 10:21:17 帮助过:3人阅读
3.Ado.net 使用表值类型
public bool updatePreSeparationAmount(DataTable dtStorePreSeparationAmount)
{
string strSpName = @"sp_preSeparationCommit";
SqlParameter[] pars =
{
new SqlParameter("@spsa",SqlDbType.Structured),
};
pars[0].Value = dtStorePreSeparationAmount;
pars[0].TypeName = "StorePreSeparationAmount";
int num = DalBase.ExecuteNonQuery(CommandType.StoredProcedure, strSpName, pars);
if (num > 0)
{
return true;
}
else
{
return false;
}
}
备注:table创建
DataTable dtStorePreSeparationAmount = new DataTable("dtStorePreSeparationAmount");
dtStorePreSeparationAmount.Columns.Add("preSeparationId", Type.GetType("System.Int32"));
dtStorePreSeparationAmount.Columns.Add("preSeparationAmount", Type.GetType("System.Decimal"));
dtStorePreSeparationAmount.Columns.Add("userCode", Type.GetType("System.String"));
DataRow drNew = dtStorePreSeparationAmount.NewRow();
drNew["preSeparationId"] = nPreSeparationId;
drNew["preSeparationAmount"] = dPreSeparationAmount;
drNew["userCode"] = login.UserName;
dtStorePreSeparationAmount.Rows.Add(drNew);
sql server 表值类型的使用
标签: