473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Multiple Queries on same asp page..

Hi,

I have an ASP page which runs a select statement such as

QueryA = "SELECT............ ;"

Set RS_A = adoDataConn.Execute(QueryA)

(adoDataConn is set in a hidden include file).

If I run RS_A and pull out the records, I then want to run another
query on a seperate table but where one field is common.

QueryB = "SELECT.........;"

Set RS_B = adoDataConn.Execute(QueryB)
I am always getting the following error:

ADODB.Recordset.1 error '80004005'

SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near
'ProductPackREC.JobNumber = 5578' at line 1

I cannot see any error in my SQL apart from the fact that I am calling
adoDataConn twice without doing anything in between it ?
What do I need to do to run both queries happily on the same page ?

Appreciate your help
David.
Jul 21 '05 #1
6 5201
On 25 Oct 2004 08:27:58 -0700, da***@scene-double.co.uk (David) wrote:
Hi,

I have an ASP page which runs a select statement such as

QueryA = "SELECT............ ;"

Set RS_A = adoDataConn.Execute(QueryA)

(adoDataConn is set in a hidden include file).

If I run RS_A and pull out the records, I then want to run another
query on a seperate table but where one field is common.

QueryB = "SELECT.........;"

Set RS_B = adoDataConn.Execute(QueryB)
I am always getting the following error:

ADODB.Recordset.1 error '80004005'

SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near
'ProductPackREC.JobNumber = 5578' at line 1

I cannot see any error in my SQL apart from the fact that I am calling
adoDataConn twice without doing anything in between it ?
What do I need to do to run both queries happily on the same page ?

Appreciate your help
David.


Please post the Sql for each statement...Cannot tell what is wrong without seeing it..

Are you attempting to use a value in RS_A in the where clause of the sql to create RS_B?
Jul 21 '05 #2

strQuery works 100%

___________________________________

strQuery = "SELECT OrderLines.PSLrepnotes, OrderLines.OrderNotes,
Customers.CustomerName, Orders.PONumber, OrderLines.JobNumber,
OrderLines.OrderQuantity, Products.ProductName, Products.BBProductName,
OrderLines.HoldonSD, OrderLines.ShipfromPSL "
strQuery = strQuery & "FROM StockMovements INNER JOIN OrderLines ON
(StockMovements.JobNumber = OrderLines.JobNumber) INNER JOIN Products ON
(OrderLines.ProductID = Products.ProductID) INNER JOIN Orders ON
(OrderLines.OrderID = Orders.OrderID) INNER JOIN Customers ON
(Orders.CustomerID = Customers.CustomerID) "
strQuery = strQuery & "WHERE OrderLines.JobNumber = " &
Session("SerialSearchJob") & ";"

Set RS = adoDataConn.Execute(strQuery)

if RS.EOF then ...........

____________________________________
PackQuery = "SELECT ProductPackREC.JobNumber,
ProductPackREC.packitemNAME, ProductPackREC.packitemDESC,
ProductPackREC.packitemQTY, ProductPackREC.packitemCODE"
PackQuery = PackQuery & "FROM ProductPackREC"
PackQuery = PackQuery & "WHERE ProductPackREC.JobNumber = " &
Session("SerialSearchJob") & ";"
Set PackRS = adoDataConn.Execute(PackQuery)

If PackRS.EOF then .................
__________________________________

Do I need to close the connection, then re-open ?

David
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3

Ooops....sorry.
After trailing my code for half a day, I discovered the error..

In the SQL statement, if you do not leave a space before the end quotes
if you are working such as

QRY = "SELECT......."
QRY = QRY & "FROM......"

then it does not recognize the SQL text....DOH...a bloody space for
hours of debugging....thats programming for you

Appreciate you looking.

Thank

David.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #4
any time you have problems with a SQL statement

Response.Write QRY
Response.End

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"David Gordon" <da***@scene-double.co.uk> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

Ooops....sorry.
After trailing my code for half a day, I discovered the error..

In the SQL statement, if you do not leave a space before the end quotes
if you are working such as

QRY = "SELECT......."
QRY = QRY & "FROM......"

then it does not recognize the SQL text....DOH...a bloody space for
hours of debugging....thats programming for you

Appreciate you looking.

Thank

David.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #5
and if these sql statements were stored procedures, you'd never had this
problem to begin with ;-)
"David Gordon" <da***@scene-double.co.uk> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

Ooops....sorry.
After trailing my code for half a day, I discovered the error..

In the SQL statement, if you do not leave a space before the end quotes
if you are working such as

QRY = "SELECT......."
QRY = QRY & "FROM......"

then it does not recognize the SQL text....DOH...a bloody space for
hours of debugging....thats programming for you

Appreciate you looking.

Thank

David.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #6
Hey! That's my line! :-)

Bob
caulker wrote:
and if these sql statements were stored procedures, you'd never had
this problem to begin with ;-)

--
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"
Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
1
by: Jeremy | last post by:
I have built a form that calls queries. I have the first 2 set up as select queries, and the third set up as a make table query. When multiple users are on this application at the same time, they...
0
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
1
by: Bob Sanderson | last post by:
I am relatively new to PHP and MySQL. This is the first time I've tried to use multiple queries in a single script. I have the following PHP script which gets a Job Number from a search form and...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
14
by: Supermansteel | last post by:
My team at work uses Cognos to run multiple queries to pull in data. Then they take that data and import into Access and then usually run an Append Query to run a RND function to pull out a few...
1
by: ll | last post by:
Hi all, I've inherited a site and am currently looking to redesign a page that displays a table of course curriculum, with each row representing a "Topic" of the curriculum. There is a courseID...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.