| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

04-22-04, 09:34
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
|
Connecting two tables from one DB
|
|
If you connect to one DB, in the sql statement how would you connect to two(2) tables? Then when you want that info shown in a table how would you code it so it would know which table to pull from?
Thanks
breeze76
|
|

04-22-04, 11:48
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
OK.. Is this how I would do it:
DIM sqlstr1, sqlstr2
sqlstr1=SELECT * tablename1
sqlstr2=SELECT * tablename2
Or should I or could I put them into on sql statement?
Then when I want to call the info from a table would I do it like this:
<%=sqlstr1'(fieldname here)'%> and do I need quotes anywhere??
breeze76
|
|

04-22-04, 12:49
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
|
|
Ok seems I am posting to myself.. but here goes.. I just need someone to look over what I am posting and to give me guidance....
Ok if I query both tables and all the info in them as I am trying to do in the first post, I guess the best way to do different things would be to call sql functions depending on what the user wants. Then I would need different tables depending on which function they call. Then I could do an IF THEN to determine which function was call and to match it to which table.
Would this be a way of doing this?
breeze76
|
|

04-22-04, 19:55
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
you are kinda skipping a phase or two,... something more like this
Code:
Dim strSql1, strSql2
strSql1="Select * from table1"
strSql2="Select * from table2"
Dim recordset1, recordset2
set recordset1 = myConnection.Execute(strSQL1)
set recordset2 = myConnection.Execute(strSQL2)
<%=recordset1(fieldname here)'%>
Don't forget to set your recordsets to nothing once you have finished and please, you should avoid using select *, specify the column names it's much nicer.
|
|

04-22-04, 22:40
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
Quote:
Originally posted by rokslide
you are kinda skipping a phase or two,... something more like this
Code:
Dim strSql1, strSql2
strSql1="Select * from table1"
strSql2="Select * from table2"
Dim recordset1, recordset2
set recordset1 = myConnection.Execute(strSQL1)
set recordset2 = myConnection.Execute(strSQL2)
<%=recordset1(fieldname here)'%>
Don't forget to set your recordsets to nothing once you have finished and please, you should avoid using select *, specify the column names it's much nicer.
|
OK, if not SELECT, then what should I use?
breeze76
|
|

04-22-04, 22:42
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
use select col1, col2, col3 etc rather then the select *.
specify your columns instead of just grabbing everything.
|
|

04-22-04, 22:49
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
WOW!!!
That was a quick reply...
Thanks, I am sur I will have more questions for you tonight anyways, am getting ready to start working on all this stuff... to bad I could not send some your way...
Thanks
breeze76
|
|

04-22-04, 22:58
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
It's the Friday before a long weekend so work isn't really keeping me very interested at the moment. 
|
|

04-22-04, 23:14
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
Well.. one more day here and it will be the weekend.. but I have a ton of stuff to do on our website.. hey, take a look at it, it is my very first web site, third version thought... Let me know what you think and if you have any suggestion for me..
www.psrdocs.com
breeze76
|
|

04-22-04, 23:23
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
Had a quick look over it. Looks okie....
|
|

04-22-04, 23:33
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 75
|
|
Thanks. another quick question.. I do not want to use a table or should I, I would like my data results postes in a paragraph type layout.
How would I do that, I can do tables, but not like the paragraph type.
breeze76
|
|

04-22-04, 23:38
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
I'm not quite sure I understand. You can use whatever layout you want... and use tables if you need to or not... it really depends on what works best for you...
If you want a suggestion as to what style would look best, whip up a couple of pages and I'll have a look at them and let you know what I like best... you could even post a poll and get other peoples opinions.
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|