Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 22nd, 2004, 09:55 AM
Pluto Pluto is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 244 Pluto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 8 h 25 m 59 sec
Reputation Power: 5
Unhappy Multiple database connections

Hi there,

I could really do with a stear in the right direction, as I think I am using really messy methods of creating multiple connections to databases... and not quite doing it in the correct way...

I have been using the following method

EXAMPLE 1

set conex7 = Server.CreateObject("ADODB.Connection")

dns7 = "Driver={SQL Server};" & _
"Server=217.76.131.33;" & _
"Address=217.76.131.33,1433;" & _
"Network=DBMSSOCN;" & _
"Database=qj003;" & _
"Uid=qj003;" & _
"Pwd=nicolas;"

conex7.Open dns7

EXAMPLES OF MULTIPLE CONNECTIONS FOR DATA

sql = "SELECT * FROM Towns Where Active=1 ORDER BY ID ASC"
set rdo = conex7.Execute(sql)

sql2 = "SELECT * FROM Clientes Where Town = "& rdo("townName") & " AND Active=1"
set rdo2 = conex7.Execute(sql2)




Now I am using this method

EXAMPLE 2

dns = "Driver={SQL Server}; Server=213.171.200.100; Address=213.171.200.100; Database=dbname; Uid=username; Pwd=password; Network=DBMSSOCN;"

set Connex = Server.CreateObject("ADODB.Connection")
set Rs = Server.CreateObject("ADODB.Recordset")

Rs.Source = SELECT * FROM Towns Where Active=1 ORDER BY ID ASC
Rs.CursorType = 1
Rs.CursorLocation = 2
Rs.LockType = 3

Connex.open dns


I kinda have 2 questions...

1. If I want to open multiple database connections, as I did on the first example, would it just be a case of running another recordset connection like this... and is this or what is the best way to do it?
... And then to extract data, would it be as before, for exampe to extract the name value for a paricular record : name = Rs2("name") ?

set Rs2 = Server.CreateObject("ADODB.Recordset")
Rs2.Source = SELECT Name, Surname FROM Users Where Active=1

Connex.open dns


2. When do I need to set the following values on a record set...

Rs.CursorType = 1
Rs.CursorLocation = 2
Rs.LockType = 3

I am doing paging allow navigation across the records returned, for example requiring, Rs.RecordCount, Rs.PageSize..... do I need to set these in this case??

Any help would be so much appreciated, as I am getting a little lost in all of this S

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Multiple database connections


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT