473,795 Members | 3,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple table connections

I have this:

<%
Dim objConn, RS, strQ, strConnection

Set objConn = Server.CreateOb ject("ADODB.Con nection")
strConnection = "DSN=Developmen t;Database=PMA_ Internet;"
objConn.Open strConnection

Set RS = Server.CreateOb ject("ADODB.Rec ordset")
Set RS.ActiveConnec tion = objConn
strQ = "Select StaffName From tbStaff"
RS.Open strQ
%>

But I now want to connect to another table. Do I close the connection
and start over again to create 'strQ = "Select CorrectType from
Corrections'?
Thanks.
Jul 19 '05 #1
1 1338
You can use the same existing connection. Or, depending on what you're
doing, you may be able to grab all the data in one query. But, there's
nothing wrong with creating and using two recordsets within the same page.
I think that you should read this though.

http://www.aspfaq.com/show.asp?id=2424

Dim objConn, RS1, RS2, strQ, strConnection

strConnection = "It'd be in your best interests to use an oledb connection
string here. See www.connections trings.com"

Set objConn = CreateObject("A DODB.Connection ")

strQ = "SELECT StaffName FROM tbStaff"
Set RS1 = objConn.Execute (strQ)

strQ = "SELECT CorrectType FROM Corrections"
Set RS2 = objConn.Execute (strQ)

'''stuff you need to do

objConn.Close : Set objConn = Nothing

Ray at work
"Vincent Jones" <vn****@hotmail .com> wrote in message
news:ba******** *************** ***@posting.goo gle.com...
I have this:

<%
Dim objConn, RS, strQ, strConnection

Set objConn = Server.CreateOb ject("ADODB.Con nection")
strConnection = "DSN=Developmen t;Database=PMA_ Internet;"
objConn.Open strConnection

Set RS = Server.CreateOb ject("ADODB.Rec ordset")
Set RS.ActiveConnec tion = objConn
strQ = "Select StaffName From tbStaff"
RS.Open strQ
%>

But I now want to connect to another table. Do I close the connection
and start over again to create 'strQ = "Select CorrectType from
Corrections'?
Thanks.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2892
by: Matthew Clubb | last post by:
Please help, a bit new to this! I've got two databases and I'm trying to look with values from one table in one database and then look up a name from the other database, the two tables are linked where 'postedby' in my newsdb database refers to 'ID' in my tblemployees table in my basedb database. All I get is one name shown and 6 records where there are actually 7. Any help would be greatly appreciated.
6
4448
by: Quiet Man | last post by:
Hi all, I'm designing a fairly simple service that will run on W2K/SP4 and W2K3 servers. It's job is to be a very specialized database server that listens on a given IP address / TCP port and handles multiple connections. Client programs will make a connection and pass text strings to the service, which will then return a value for each of the strings. It's unlikely the service will ever have more than 100 simultaneous connections and...
9
23084
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated to a pool. If I assign only one application to a applicaton pool and have multiple worker processes assigned to that pool. Will my application be processed by many worker processes?
3
8699
by: rallykarro | last post by:
Hi, How do I at the best way perform select statements over multiple databases? I have a couple of databases containing the same table definitions with diffrent data. Now I want them to act as a single database giving me one answer on a select statement but the answer fetched from all my defined databases.
35
9367
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from 500000 to 3200000 of a file whose size is say 20MB... how do i request a download which starts directly at 500000th byte... thank u cheers
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.