I have a stored procedure which works perfectly fie when I run it directly on the db. The same stored procedure gives me error when I run it from the c# code.
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I have a stored procedure which works perfectly fie when I run it directly on the db. The same stored procedure gives me error when I run it from the c# code.
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
As the error states the procedure has an subquery that returns multiple results. Your test does not cause the subquery to return multiple results. The C# code is mostly likely passing parameters that cause the subquery to return more than one record which
is not covered in your test.
I have used the same parameters when I'm running it through code as well as when I'm running directly. In fact while debugging the code I checked if the correct parameters has been sent or not and everything looks good but I get the error when ran from code.
I have used the same parameters when I'm running it through code as well as when I'm running directly. In fact while debugging the code I checked if the correct parameters has been sent or not and everything looks good but I get the error when ran from code.
The error is very specific. There is not much we can do without code that reproduces the error.
Member
36 Points
181 Posts
Stored procedure works fine i db but not from the code
Jan 24, 2018 05:59 PM|slm3003|LINK
I have a stored procedure which works perfectly fie when I run it directly on the db. The same stored procedure gives me error when I run it from the c# code.
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
All-Star
50841 Points
9895 Posts
Re: Stored procedure works fine i db but not from the code
Jan 24, 2018 07:12 PM|A2H|LINK
If possible provide the code in which you are facing this issue
Aje
My Blog | Dotnet Funda
All-Star
52971 Points
23571 Posts
Re: Stored procedure works fine i db but not from the code
Jan 24, 2018 07:58 PM|mgebhard|LINK
As the error states the procedure has an subquery that returns multiple results. Your test does not cause the subquery to return multiple results. The C# code is mostly likely passing parameters that cause the subquery to return more than one record which is not covered in your test.
Member
36 Points
181 Posts
Re: Stored procedure works fine i db but not from the code
Jan 25, 2018 02:36 PM|slm3003|LINK
I have used the same parameters when I'm running it through code as well as when I'm running directly. In fact while debugging the code I checked if the correct parameters has been sent or not and everything looks good but I get the error when ran from code.
All-Star
52971 Points
23571 Posts
Re: Stored procedure works fine i db but not from the code
Jan 25, 2018 03:33 PM|mgebhard|LINK
The error is very specific. There is not much we can do without code that reproduces the error.