473,396 Members | 1,671 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,396 software developers and data experts.

Multiple Queries

I have a VB7 aspx file I am creating that requires multiple queries each
dependant on the previous queries results. If I run these queries in foxpro,
I just run a query then create a cursor with the results of that cursor, then
run another query based on that cursor etc. My question is, how do I do this
in a VB7 aspx file? Below I have the code for the first query but I am not
sure where to go from here to run the rest of the queries that are after this
one.

dim FirstQuerySQL as String = "SELECT somast01.sono, somast01.custno,
somast01.u_cono, somast01.uname, somast01.utitle, somast01.uphone,
somast01.sodate, (somast01.shpamt + somast01.ordamt) AS Total_Sales,
somast01.u_id " & _
"FROM somast01 WHERE BETWEEN(sodate,{^2004/08/02},{^2004/09/02}) " & _
"AND somast01.u_id <> ' ' " & _
"UNION " & _
"SELECT soymst01.sono, soymst01.custno, soymst01.u_cono, soymst01.uname,
soymst01.utitle, somast01.uphone, soymst01.sodate, (soymst01.shpamt +
soymst01.ordamt) AS Total_Sales, soymst01.u_id " & _
"FROM soymst01 " & _
"WHERE soymst01.sono <> somast01.sono AND
BETWEEN(sodate,{^2004/08/02},{^2004/09/02}) " & _
"AND soymst01.u_id <> ' ' "

debug.writeline(FirstQuerySQL)
dim oDataConn as DataConn = new DataConn()
oDataConn.Open()
Dim objDataReader As OleDbDataReader =
oDataConn.GetDataReader(FirstQuerySQL)

Dim Dtable As Datatable = oDataConn.BuildDataTable(FirstQuerySQL)

LookupGrid.DataSource= Dtable
LookupGrid.DataBind()
oDataConn.close()
Nov 21 '05 #1
1 1593
you can convert your queries into a nested query(nested select statement)
also you can use "into" statement ,i use it in pl/sql .
Nov 21 '05 #2

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...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
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...
8
by: beretta819 | last post by:
Ok, so I apologize in advance for the wordiness of what follows... (I am not looking for someone to make this for me, but to point me in the right direction for the steps I need to take.) I was...
7
by: vaiism | last post by:
I am creating a report that outputs the contact information and details about a water treatment plant, and needs to include information about people who work there. If I tie all the information...
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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...
0
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...
0
tracyyun
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...

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.