I have a client site where the code below has been working happily for at
least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
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.Sql Client.SqlExcep tion: 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 now 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(strS QL as String)
Dim conn As New System.Data.Sql Client.SqlConne ction(CONN_STRI NG)
Dim cmd As New System.Data.Sql Client.SqlComma nd(strSQL, conn)
cmd.Connection. Open()
cmd.ExecuteNonQ uery()
conn.Close()
End Sub
Any help would be greatly appreciated.
Rod. 5 6592
Rod:
Are you expecting multiple rows returned from that inner most sql statement?
"Rod" <1g******@newsg roup.nospam> wrote in message
news:Ok******** ********@TK2MSF TNGP10.phx.gbl. .. I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
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.Sql Client.SqlExcep tion: 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 now 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(strS QL as String) Dim conn As New System.Data.Sql Client.SqlConne ction(CONN_STRI NG) Dim cmd As New System.Data.Sql Client.SqlComma nd(strSQL, conn) cmd.Connection. Open() cmd.ExecuteNonQ uery() conn.Close() End Sub
Any help would be greatly appreciated.
Rod.
the posted statement has no subquery, check to see if a trigger exists on
the table, which might throw the error, otherwise, you do not have the
correct failing sql cmd text.
-- bruce (sqlwork.com)
"Rod" <1g******@newsg roup.nospam> wrote in message
news:Ok******** ********@TK2MSF TNGP10.phx.gbl. .. I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
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.Sql Client.SqlExcep tion: 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 now 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(strS QL as String) Dim conn As New System.Data.Sql Client.SqlConne ction(CONN_STRI NG) Dim cmd As New System.Data.Sql Client.SqlComma nd(strSQL, conn) cmd.Connection. Open() cmd.ExecuteNonQ uery() conn.Close() End Sub
Any help would be greatly appreciated.
Rod.
Thanks for the response.
Yes multiple rows are returned from the innermost Select statement, but the
statement works when run on the SQL Server via Query Analyser and inserts
multiple rows in the target table. It has worked in the existing code for
months.
I would expect the error I am getting if the statement read something like
Insert Into <table> (<field list>) Select <data fields> From <othertable>
Where <key> = (Select <keyvalue> from <yetanothertabl e> Where <condition
returns multiple values>)
Rod
"E. Rodriguez" <bl*@geemail.co m> wrote in message
news:e0******** ******@TK2MSFTN GP09.phx.gbl... Rod:
Are you expecting multiple rows returned from that inner most sql
statement?
"Rod" <1g******@newsg roup.nospam> wrote in message news:Ok******** ********@TK2MSF TNGP10.phx.gbl. ..I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
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.Sql Client.SqlExcep tion: 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 now 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(strS QL as String) Dim conn As New System.Data.Sql Client.SqlConne ction(CONN_STRI NG) Dim cmd As New System.Data.Sql Client.SqlComma nd(strSQL, conn) cmd.Connection. Open() cmd.ExecuteNonQ uery() conn.Close() End Sub
Any help would be greatly appreciated.
Rod.
Bruce,
I'm not sure what you mean by 'you do not have the correct failing sql cmd
text.' but you might be onto something with the trigger idea. Someone else
has been employed to do additional work on the system since I completed my
contract and has been creating triggers on the tables.
They may have done something to cause the problem. It's always good to be
able to blame something someone else has done. (I jest (a little)).
Rod
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:uF******** *****@TK2MSFTNG P12.phx.gbl... the posted statement has no subquery, check to see if a trigger exists on the table, which might throw the error, otherwise, you do not have the correct failing sql cmd text.
-- bruce (sqlwork.com)
"Rod" <1g******@newsg roup.nospam> wrote in message news:Ok******** ********@TK2MSF TNGP10.phx.gbl. ..I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
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.Sql Client.SqlExcep tion: 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 now 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(strS QL as String) Dim conn As New System.Data.Sql Client.SqlConne ction(CONN_STRI NG) Dim cmd As New System.Data.Sql Client.SqlComma nd(strSQL, conn) cmd.Connection. Open() cmd.ExecuteNonQ uery() conn.Close() End Sub
Any help would be greatly appreciated.
Rod.
Bruce,
It was a trigger. Thanks for the suggestion.
Rod.
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:uF******** *****@TK2MSFTNG P12.phx.gbl... the posted statement has no subquery, check to see if a trigger exists on the table, which might throw the error, otherwise, you do not have the correct failing sql cmd text.
-- bruce (sqlwork.com)
"Rod" <1g******@newsg roup.nospam> wrote in message news:Ok******** ********@TK2MSF TNGP10.phx.gbl. ..I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
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.Sql Client.SqlExcep tion: 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 now 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(strS QL as String) Dim conn As New System.Data.Sql Client.SqlConne ction(CONN_STRI NG) Dim cmd As New System.Data.Sql Client.SqlComma nd(strSQL, conn) cmd.Connection. Open() cmd.ExecuteNonQ uery() conn.Close() End Sub
Any help would be greatly appreciated.
Rod.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris Langston |
last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server
that is experiencing strange shutdown problems. We are using ASP.NET v1.1
and our application is written in VB.NET
Here's the scenario:
1. .NET Windows Client on a remote machine makes a web service call to
update tables on a Web Server running SQL Server 2000.
2. The Update is updating about 1000 - 3000 records doing simple update
statements like "Update...
|
by: Ersin Gençtürk |
last post by:
we are getting :
System.Web.HttpUnhandledException: Exception of type
System.Web.HttpUnhandledException was thrown. --->
System.Data.SqlClient.SqlException: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at...
|
by: HK |
last post by:
I just moved an ASP.NET application to a new web server at a different
location of ours. The SQL Server machine was moved to that new location at
the same time as the web site DNS was pointed to the new server. Suddenly
I'm getting lots of intermittent errors of this type.
The switch/hub/repeater that routes the traffic at the new location is an
older one, if that makes any difference.
One thing that bothers me is that the SQL...
|
by: Manuel Canas |
last post by:
Hello there,
I am using the VB.NET Standart Edition compiler and I would like to know if
this is not supported on this edition.
This is just a testing code from a book that I'm trying here and it builds
with no problem, but when I run it I get and error.
This is the code snipet;
|
by: Rampa |
last post by:
hello! the problem is always the same but i can't understand why it
happens!! Someone can help me? FIRST QUERY GOES WELL, SECOND BREAK WITH
ERROR why?
Dim connessione As New
SqlClient.SqlConnection("Server=SOSQLSRV01;Initial
Catalog=SO_Bolle;Uid=SO_CattolicaRE;PWD=sogeda")
Dim iddestinatario As Integer
Dim TestoQueryCodicecodicedestinario As String = "SELECT
| |
by: weird0 |
last post by:
This is the exception that I get when i create a webserivce obj and
call. The error comes on the webmethod call, when it opens a
connection to the db.
How do I fix it? What is the solution to this?
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---System.Data.SqlClient.SqlException: An attempt
to attach an auto-named database for file g:\inetpub\wwwroot
\BankingService\App_Data\BankingDb.mdf failed....
|
by: Carol |
last post by:
Exception may be thrown in the code inside the try block.
I want to handling the SqlException with State == 1 in a special way,
and for all others I want to use a general way to handle. Which of the
following options is better?
-----------------------------------------------------
Option 1:
try{...}
catch (System.Data.SqlClient.SqlException ex)
{
if (ex.State == 1)
|
by: thithi |
last post by:
Please help me
" System.Data.SqlClient.SqlException: Prepared statement '(@Name varchar(100),@Describes varchar(100),@Money char(10))Upda' expects parameter @Describes, which was not supplied. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Assignment.rose.dtgFlower_UpdateCommand(Object source,...
|
by: lily86 |
last post by:
i'm very new so i hope all of u can help me. when i debug my webforms this error occur "An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error." pls help me solve the problem...thanks..
my code:
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.Globalization
Imports System.Threading
Public Class PhoneBook
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |