locked
Stored procedure works fine i db but not from the code RRS feed

  • Question

  • User2054871671 posted

    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. 

    Wednesday, January 24, 2018 5:59 PM

All replies

  • User2103319870 posted

    If possible provide the code in which you are facing this issue

    Wednesday, January 24, 2018 7:12 PM
  • User475983607 posted

    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.

    Wednesday, January 24, 2018 7:58 PM
  • User2054871671 posted

    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. 

    Thursday, January 25, 2018 2:36 PM
  • User475983607 posted

    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.  

    Thursday, January 25, 2018 3:33 PM