Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Database tables
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Database tables

 Post Reply Post Reply
Author
nay27uk View Drop Down
Newbie
Newbie
Avatar

Joined: 30 August 2003
Location: United Kingdom
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote nay27uk Quote  Post ReplyReply Direct Link To This Post Topic: Database tables
    Posted: 30 August 2003 at 3:53pm

 Hi all.

Im new to this forum and to asp i have to say i have found this site invalubale in starting on the long road to lerning to programe using asp. I have searched the net wide and far for over a year and a half now for a asp tutorial and found them all to dificult to follow untill i found the tutorials within this site. Thanks to this site i have now produced my first asp script and started work on my second if you want to see my first you can see it here http://www.sell-uk.net/gbfree/view.asp Although this site has been an insperation i find myself at the point wher i would like to progress and my second project has a database with more than one table although the tutorials on this site are a great help they do not explane how to encoperate more than one database table into one asp page. This is what i would like for somone to please explaine to me please remember that im a compleat newbe to this and do not fully understand what things do what all i need to know is HOW do i use two database table that are not related in one asp page I.E one table would be the maine script table and the second would be a config table with bacground info text type and so on.

How do i do this

REGARDS

NATHAN

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 30 August 2003 at 11:11pm
If you want to query two tables that are not related to each other you would just sperate it in two queries. If one of them is just a config table do the query at the beginning of you page or put it into a header file which you can include into every page.
So basically unless you have two related tables just do one query after another ie using 2 recordsets.
Back to Top
nay27uk View Drop Down
Newbie
Newbie
Avatar

Joined: 30 August 2003
Location: United Kingdom
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote nay27uk Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2003 at 9:34am
Thanks very mutch but im not sure as how to do this i have tryed this by doubling all the code in the page fron the sql= statement ie twoXset rs =nothing and so on but this threw up errors
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2003 at 10:20am

'You general database connection here you only need that once unless they are 2 diff db's

strSQL1 = "Select * from table1"
set rs1 = conn.Execute(strSQL1)
If rs1.BOF or rs1.EOF THEN
 'Give message
ELSE
 WHILE NOT rs1.EOF
     Display your data
 rs1.MoveNext
 WEND
END IF

Set rs1 = NOTHING

strSQL2 = "Select * from table2"
set rs2 = conn.Execute(strSQL2)
If rs2.BOF or rs2.EOF THEN
 'Give message
ELSE
 WHILE NOT rs2.EOF
     Display your data
 rs2.MoveNext
 WEND
END IF

Set rs2 = NOTHING

'Close your db connection here

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.