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,帶參數輸入,輸出ui