Results 1 to 3 of 3

Thread: Please Help!

  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Exclamation Please Help!

    hey guys, i'm having real trouble with a page i can't access, that's really really important! It use to work, but now everytime i go to it, it says,

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [SqlException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.]
    System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
    System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior behavior) +45
    DotNetNuke.SchedulesDB.GetRefSchedList(Int32 ModuleId, Int32 UserId, Int32 RICRoleId, Int32 RefRoleId, String History, String StartDate, String EndDate)
    DotNetNuke.RefSchedules.Page_Load(Object sender, EventArgs e)
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +35
    System.Web.UI.Control.LoadRecursive() +98
    System.Web.UI.Control.LoadRecursive() +98
    System.Web.UI.Control.LoadRecursive() +98
    System.Web.UI.Control.LoadRecursive() +98
    System.Web.UI.Page.ProcessRequestMain() +731

    i have absolutely no idea what this all means! please help !!

  2. #2
    Join Date
    Nov 2003
    Posts
    1

    Re: Please Help!

    This error is caused by a sub-query that return more than 1 value that is used by a query with one of the operators showed in the error description.

    For example,
    consider the following query:

    Delete
    From ECommerceRigheOrdini
    Where IdTestata = (
    Select R.IdTestata
    From ECommerceRigheOrdini R Inner Join ECommerceTestateOrdini T
    On R.IdTestata = T.IdTestata
    Where R.IdTestata = @IdTestata
    And T.CodiceCliente = @CodiceCliente
    And T.SuffissoCliente = @SuffissoCliente
    And T.Status = 'N'
    )

    , that contains 3 parameters (@IdTestata, @CodiceCliente and @SuffissoCliente)

    If the sub-query

    Select R.IdTestata
    From ECommerceRigheOrdini R Inner Join ECommerceTestateOrdini T
    On R.IdTestata = T.IdTestata
    Where R.IdTestata = @IdTestata
    And T.CodiceCliente = @CodiceCliente
    And T.SuffissoCliente = @SuffissoCliente
    And T.Status = 'N'

    returns more than 1 value (or record), its result cannot be used by the delete query, because the "=" operator has a list of values (records) on the right (and it has no sense).

    If the select statement returns only 1 value, e.g. 150, you can imagine a query like this:

    Delete
    From ECommerceRigheOrdini
    Where IdTestata = (150)

    that is correct,

    but if the select statement returns two rows than the global sql query is wrong.

    I hope this can help.


    Bye.

  3. #3
    Join Date
    Nov 2003
    Posts
    4

    Cool subquery

    yep!

    Instead of a subquery I used a fieldname.
    no more errors!
    Tanx!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •