首页 > 数据库技术 > 详细

MVC c# 调用sql的存储过程

时间:2016-08-11 15:52:54      阅读:170      评论:0      收藏:0      [点我收藏+]
var hid = new SqlParameter { ParameterName = "HistoryId", Value = history.Id, Direction = ParameterDirection.Input };
var sid = new SqlParameter { ParameterName = "StoreId", Value = StoreId, Direction = ParameterDirection.Input };
var qrcode = new SqlParameter { ParameterName = "QRCode", Value = strQRCode, Direction = ParameterDirection.Input };
var guidcode = new SqlParameter { ParameterName = "GUIDCode", Value = strGUIDCode, Direction = ParameterDirection.Input };
var result = new SqlParameter { ParameterName = "Result", Value = 0, Direction = ParameterDirection.Output };
db.Database.ExecuteSqlCommand("exec @Result = OptStock @HistoryId,@StoreId,@QRCode,@GUIDCode", hid, sid, qrcode, guidcode, result);


model.Status = (int)result.Value;

存储过程为OptStock,带参数输入,输出

MVC c# 调用sql的存储过程

原文:http://www.cnblogs.com/Zatsugaku-code/p/5761014.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!