Re: System.Data.SqlClient.SqlException: Subquery returned more than 1 value.



Thanks Bob.

I noticed after I posted that the group was .asp not aspnet, but I
appreciate your willingness to have a look at my problem. I'm much happier
using asp but one has to move with the times, or at least try to.

Rod.



"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:uki9PWIXFHA.160@xxxxxxxxxxxxxxxxxxxxxxx
> There was no way for you to know it, but this is a classic asp newsgroup.
> While you may be lucky enough to find a dotnet-savvy person here who can
> answer your question, you can eliminate the luck factor by posting your
> question to a group where those dotnet-savvy people hang out. I suggest
> microsoft.public.dotnet.framework.aspnet.
>
> However, I'll take a stab at it (I've just started using .Net)
>
>
> Rod wrote:
> > I have a client site where the code below has been working happily
> > for at least four months. Last week an error appeared related to the
> > following SQL statement.
> >
> > The site is using SQL Server 7. The code is ASP.NET
> >
> > An example of the SQL statement is:
> >
> > INSERT INTO OrderItems (ClientID, ProductID, OrderHeaderID, Quantity,
> > Dispatched, BackOrdered) SELECT ClientID, ProductID, 1371 AS
> > OrderHeaderID, Quantity, Dispatched, BackOrdered FROM Basket WHERE
> > RequisitionID = 1369
> >
> > The error message is:
> >
> > 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...
> >
> > There appears to be nothing wrong with the SQL Statement, indeed if
> > run in Query Analyser it executes correctly. I cannot see how the
> > error message relates to the code at all. Nor do I understand why
> > the code worked for four months and has not decided to fail.
> >
> > The context in which the code is called is the procedure below where
> > the SQL statement is passed to the parameter strSQL.
> >
> > Private Sub executeSQL(strSQL as String)
> > Dim conn As New System.Data.SqlClient.SqlConnection(CONN_STRING)
> > Dim cmd As New System.Data.SqlClient.SqlCommand(strSQL, conn)
> > cmd.Connection.Open()
> > cmd.ExecuteNonQuery()
> > conn.Close()
> > End Sub
> >
>
> Well, you're right. This error seems to be totally unrelated to this
> statement. There is no subquery here.
>
> Is the error reproducible? Try using SQL Profiler to trace what's actually
> happening.
>
> Bob Barrows
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>


.



Relevant Pages

  • Re: Formatierungsproblem
    ... > Wie soll denn so ein EIN SQL Statement aussehen? ... > IE Schwierigkeiten bei der Darstellung und schließlich auch bei der ... ja nie welchen Browser der User hat, wie er diesen konfiguriert hat usw. ... > Ich sollte wirklich versuchen alles mit ASP zu managen. ...
    (microsoft.public.de.inetserver.iis.asp)
  • RE: Is this correct syntax for OLE DB for ODBC parameter query?
    ... (Just a brief review of that SQL statement) ... You may have more information from ASP .NET team. ... data showing up in the second list when the page loads or I make a selection ...
    (microsoft.public.data.odbc)
  • Re: Random sort via SQL in ASP
    ... and I will be calling this recordset in a SQL statement from ... randomize from ASP? ... I'd write some code that you can trigger that puts a random ... number in a field (e.g. sortfield as long) in the table. ...
    (comp.databases.ms-access)
  • Parameter passing query
    ... I’ve developed a ASP page that searches a database on our web server. ... created a html form that passes parameters to a SQL statement on the ASP ... Although the data is held in the ‘Info’ field, the SQL statement doesn’t use ...
    (microsoft.public.frontpage.programming)
  • Parameter passing within a ASP page
    ... I’ve developed a ASP page that searches a database on our web server. ... created a html form that passes parameters to a SQL statement on the ASP ... Although the data is held in the ‘Info’ field, the SQL statement doesn’t use ...
    (microsoft.public.frontpage.programming)