1

Does anyone have any suggestions as to why the variable works returns 743 rows, but the variable notworks returns none?

As far as I can see they are doing the same thing.

I cannot publish the stored procedure, but I don't think that is the issue here as I am able to get a result set from the first variable.

I tried using a SQL trace - which I am new to - and could not see anything that helped me solve this.

var TretSpefParameter = new SqlParameter("TretSpef", "101");
var SexParameter = new SqlParameter("Sex", 1);
var SDiagParameter = new SqlParameter("SDiag", "*");

var works = await Context.Database.SqlQuery<sp_RefData_Predictive>("sp_RefData_Predictive @TretSpef = '101', @Sex = 1, @SDiag = '*'").ToListAsync();

var notWorks = await Context.Database.SqlQuery<sp_RefData_Predictive>("sp_RefData_Predictive @TretSpef, @Sex, @SDiag", TretSpefParameter, SexParameter, SDiagParameter).ToListAsync();
3

1 Answer 1

1

I had to change:

@TretSpef, @Sex, @SDiag

to

@TretSpef=@TretSpef, @Sex=@Sex, @SDiag=@SDiag


var notWorks = await Context.Database.SqlQuery<sp_RefData_Predictive>("sp_RefData_Predictive @TretSpef=@TretSpef, @Sex=@Sex, @SDiag=@SDiag", TretSpefParameter, SexParameter, SDiagParameter).ToListAsync();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.