当我运行以下ExecuteStoreQuery时,会立即抛出InvalidOperationException并显示以下消息:
执行命令时,参数必须是数据库参数或值。
SqlParameter param1 = new SqlParameter("@pNetworkHealthAssessmentID", pNetworkHealthAssessmentID);
SqlParameter param2 = new SqlParameter("@pRiskAssessmentQuestionsID", pRiskAssessmentQuestionsID);
SqlParameter param3 = new SqlParameter("@pUserID", UserID);
SqlParameter param4 = new SqlParameter("@pSortOrder", pSortOrder);
var result = db.Database.ExecuteSqlCommand("sp_RiskAssessmentQuestion_Copy2Network @pNetworkHealthAssessmentID, @pRiskAssessmentQuestionsID, @pUserID", "@pSortOrder",
param1, param2, param3, param4)
存储过程的参数如下所示:
CREATE PROCEDURE [dbo].[sp_RiskAssessmentQuestion_Copy2Network] (
@pNetworkHealthAssessmentID bigint
,@pRiskAssessmentQuestionsID bigint
,@pUserID bigint
,@pSortOrder int
)
存储过程不会返回任何值。为什么我得到那个例外?我已经尝试了所有可能的解决方案,但到目前为止还不成功
答案 0 :(得分:5)
你没有包括最后一个参数,jQuery.hide
用逗号分隔,它应该是第一个字符串的一部分。
"pSortOrder"