String[2]: Size 属性具有无效大小值 0

报错代码

SqlParameter voteFrom = new SqlParameter("@voteFrom", workFlow.VoteFrom);
SqlParameter voteTo = new SqlParameter("@voteTo", workFlow.VoteTo);
SqlParameter result = new SqlParameter("@result", SqlDbType.NVarChar,50);//报错原因:输出需要加长度,添加后正常。
result.Direction = ParameterDirection.Output;

context.Database.SqlQuery("exec [workflow_CheckAccount] @voteFrom,@voteTo,@result out", voteFrom, voteTo,result).FirstOrDefault();//报错行。
checkResult =(string)result.Value;

你可能感兴趣的:(c#基础)