Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Open Multiple SQLs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Open Multiple SQLs

 Post Reply Post Reply
Author
Aumuz View Drop Down
Groupie
Groupie
Avatar

Joined: 14 March 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aumuz Quote  Post ReplyReply Direct Link To This Post Topic: Open Multiple SQLs
    Posted: 17 August 2003 at 9:58pm

Is it possible to open multiple SQLs at one time?

Would the code be somthing like this?

<% site_record.open SQL_1, SQL_2, site_data_base %>

Easily answered question, but I don't have them time to find out right now, nore do I have the need for it right now (but by tuesday I will).

If its not possibel how do I get around it?

Like this?

<% site_record_1.open SQL_1, site_data_base %>

<% site_record_2.open SQL_2, site_data_base %>

Thanks for any help you can give me.

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2003 at 10:23pm
it is possible to sende multiple queires with a single call via SQL, but the database you are using has to be bale to support it. SQL Server does, but Access does not. The syntax is the same as using a single SQL query except your queries need to be separated by a semi-colon (for SQL Server) and your recordset object will have multiple recordsets which you can move through using RecordSetName.NextRecordSet(). If you are using SQL Server, I highly recommend taking advantage of this as it can reduce the time taken to generate a page.

If you are using Access then you will just have to use multiple calls. If you want to use the same recordset name over and over then you can move the recordset information into an array by using
arrayName = RecordSetName.GetRows

Back to Top
3BEPb View Drop Down
Groupie
Groupie


Joined: 07 August 2003
Location: United States
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote 3BEPb Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2003 at 1:08am

ljamal, it's funny, and I read a lot about Access cannot handle multiple queries, however I did it many times... and I have no idea why I did it, if it's impossible...

p.s. I'm using my PC for couple of years and it never freezes. Am I doing something wrong?

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2003 at 5:41am
It's not possible for Access to process multiple queries from a single SQL statement. The JET engine that Access uses to process SQL statements does not allow it. It will allow processing one SQL statement after another with separate trips to the database, but not 2 or more queries in one trip to the database. If you think you have sent multiple queries then I would love for you to post the code with the statements.
Back to Top
Aumuz View Drop Down
Groupie
Groupie
Avatar

Joined: 14 March 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aumuz Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2003 at 6:45am
Ok, thanks...
Back to Top
3BEPb View Drop Down
Groupie
Groupie


Joined: 07 August 2003
Location: United States
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote 3BEPb Quote  Post ReplyReply Direct Link To This Post Posted: 21 August 2003 at 9:51am

-- but not 2 or more queries in one trip to the database ---

ljamal, does it mean INNER JOINS won't work?

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 21 August 2003 at 11:13am
An join (inner or outer) is still a single query no matter how many tables are included. With SQL server you can do this:

strSQL = "select * from table; select * from table2; select * from table3"
Set RS=Conn.Execute(strSQL)

and it will return a recordset object that contains 3 recordsets. With Access you have to call each query one at a time to get the 3 recordsets like below:

strSQL = "select * from table"
Set rs1 = Conn.execute(strSQL)

strSQL = "select * from table2"
Set rs2 = Conn.execute(strSQL)

strSQL = "select * from table3"
Set rs3 = Conn.execute(strSQL)
Back to Top
3BEPb View Drop Down
Groupie
Groupie


Joined: 07 August 2003
Location: United States
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote 3BEPb Quote  Post ReplyReply Direct Link To This Post Posted: 21 August 2003 at 1:09pm

Gotcha!

Thanks, for explanations. Everything works because I opened all recordsets separatelly.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.