Last post Feb 16, 2017 06:05 PM by krisrajz
Feb 16, 2017 03:10 PM|krisrajz|LINK
I am getting this error message:
The data reader has more than one field. Multiple fields are not valid for EDM primitive or enumeration types
The stored procedure takes three parameters, two of them being varchar and the last being int
All the parameters have values, when I execute stored procedure manually with the same values it ran successfully.
var output = Context.DbQuerySingle<string>(query, sqlParams.ToArray());
Feb 16, 2017 03:30 PM|PatriceSc|LINK
The error message seems to tell that your query return multiple columns when a single column is expected (also it needs to return a single row).
When testing your SP manually how many columns does it return?
Feb 16, 2017 05:01 PM|krisrajz|LINK
The stored proc does not return anything!
Feb 16, 2017 05:15 PM|PatriceSc|LINK
Even if the message is misleading have you tried to fix that ?
When seeing a DbQuerySingle<string> call I would expect that the SP should return a single row and a single column so that the return value can be populated. Or are you using some other mechanism?
Or if you don't expect to get a value from this SP, you should likely call another method (seems to be your own helpers ?). For now it seems really to me that the SP just doesn't return what the db access API you are using is expecting (rather than being
a problem with the parameters you are passing).
Feb 16, 2017 06:05 PM|krisrajz|LINK
I made the stored proc to return something and this has fixed the issue!