执行存储过程之前先选中数据库!!! 执行不带参数的存储过程 exec p_bs_rep_sale_detail 执行带单个参数的存储过程 exec p_bs_rep_sale_detail ‘ F191001007‘ 执行带多个参数的存储过程 exec p_bs_
执行存储过程之前先选中数据库!!!
执行不带参数的存储过程
exec p_bs_rep_sale_detail
执行带单个参数的存储过程
exec p_bs_rep_sale_detail ‘F191001007‘
执行带多个参数的存储过程
exec p_bs_rep_sale_detail @bdate=‘2019-10-01‘,@edate=‘2019-10-31‘,@type=‘sale‘,@saleid=‘001‘,@cropsno=‘‘,@mode=‘S‘
创建存储过程
if object_id(‘p_bs_rep_sale_detail‘) is not null drop proc p_bs_rep_sale_detail go CREATE …… …… go(结束位置)
c# Dapper执行存储过程
var param = new DynamicParameters();
param.Add("@bdate", req.Datebegin); param.Add("@edate", req.Dateend); param.Add("@type", req.Type); param.Add("@saleid", req.Saleid); param.Add("@cropsno", req.Cropsno); param.Add("@mode", req.Mode); list = conn.Query<GetRepSaleRes>("p_bs_rep_sale_detail", param, null, true, null, CommandType.StoredProcedure).ToList(); result.Result = list; result.TotalRecords = list.Count(); return Success(result);
c# SqlSugar执行存储过程
var bdate = new SugarParameter("@bdate", req.Datebegin); var edate = new SugarParameter("@edate", req.Dateend); var type = new SugarParameter("@type", req.Type); var saleid = new SugarParameter("@saleid", req.Saleid); var cropsno = new SugarParameter("@cropsno", req.Cropsno); var mode = new SugarParameter("@mode", req.Mode); list = res.conn.Ado.UseStoredProcedure().SqlQuery<GetRepSaleRes>("p_bs_rep_sale_detail", bdate, edate, type, saleid, cropsno, mode).ToList(); result.Result = list; result.TotalRecords = list.Count(); return Success(result);