Multiple Queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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()
 
you can convert your queries into a nested query(nested select statement)
also you can use "into" statement ,i use it in pl/sql .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top