這裏執行Sp_SetAppRole是我的代碼:從ExecuteSqlCommand
SqlParameter rolename = new SqlParameter("rolename", SqlDbType.VarChar);
rolename.Direction = ParameterDirection.Input;
rolename.Value = "role";
SqlParameter password = new SqlParameter("password", SqlDbType.VarChar);
password.Direction = ParameterDirection.Input;
password.Value = "[email protected]";
SqlParameter fCreateCookie = new SqlParameter("fCreateCookie", SqlDbType.Bit);
fCreateCookie.Direction = ParameterDirection.Input;
fCreateCookie.Size = 100;
fCreateCookie.Value = true;
SqlParameter cookie = new SqlParameter("cookie", SqlDbType.VarBinary);
cookie.Direction = ParameterDirection.Output;
cookie.Size = 8000;
_context.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, "EXEC sp_setapprole @rolename,@password,@fCreateCookie, @cookie OUT;", rolename, password, fCreateCookie, cookie);
而且我正在一個錯誤:
正式參數「@fCreateCookie」未聲明作爲輸出參數,但實際參數傳入請求的輸出。
有人能告訴我我做錯了什麼嗎?
@fcreatecookie前添加paramerer @encrypt = '無' 能證明你的SP代碼 –
@NazirUllah這是系統的SP。不是我的SP。 –