LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to use more than one databases in a macro

Hi all,

i have a problem that i need to connect to two databases concurently to
retrieve records. But i never try more than one database before i use the
same way of databases connection format by chnaging the variables name, the
result still from previous database that i connect.
this is my code:

Dim con, recordSet
Dim con1, recordSet1

'Create a connection to ms sql server
Set con = CreateObject("ADODB.Connection")
Set recordSet = CreateObject("ADODB.Recordset")

con.Provider = "SqlOleDB"
con.Properties("Data Source").Value = "localhost"
con.Properties("Initial Catalog").Value = "bbiprod"
con.Properties("Integrated Security").Value = "SSPI"

con.Open

Set con1 = CreateObject("ADODB.Connection")
Set recordSet1 = CreateObject("ADODB.Recordset")

con1.Provider = "SqlOleDB"
con1.Properties("Data Source").Value = "localhost"
con1.Properties("Initial Catalog").Value = "bbidev"
con1.Properties("Integrated Security").Value = "SSPI"

con1.Open


Please help me......thank you yea.

regards,
vanessa

--
Message posted via http://www.officekb.com
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
databases Alma Excel Worksheet Functions 0 October 17th 07 06:45 PM
Databases Az Stretch Excel Discussion (Misc queries) 0 March 29th 06 09:36 AM
connecting to databases dstiefe Excel Discussion (Misc queries) 1 September 4th 05 03:40 AM
LINK DATABASEs John Knapczyk New Users to Excel 1 February 28th 05 02:17 PM
DATABASES becky Excel Discussion (Misc queries) 3 January 20th 05 09:03 PM


All times are GMT +1. The time now is 07:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"