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: 31
Default SQL Server Connection Pooling

I am trying to optimize my vba procedure to use connetion pooling when
connecting to the sql server. My question is after I have made my connection
and set that as a global variable how to I then use it to perform a select
statement.

I thought it would be as simple as CMPW_Connect.open with my SQL select
stament following but no luck. I believe my connection pooling code is
correct I just need help retrieving the data later in the application.

Public CMPW_Connect As ADODB.Connection


'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
' Comments: Creates a pooled connection to a SQL Server database.
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
Public Sub ConnectToDatabase()

Const sSOURCE As String = "ConnectToDatabase"

Dim lAttempt As Long
Dim sConnectCMPW As String
Dim sConnectBPCS As String
'On Error GoTo ErrorHandler

' Create the connection string to CMPW database
sConnectCMPW = "Provider=SQLOLEDB;" & _
"Data Source=WC0337\HWS;" & _
"Initial Catalog=HWS;" & _
"Integrated Security=SSPI"

Set CMPW_Connect = New ADODB.Connection
CMPW_Connect.ConnectionString = sConnectCMPW
CMPW_Connect.Open
CMPW_Connect.Close

Many thanks!

 
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
ADO connection problem when using server Bkraska Excel Programming 7 March 18th 05 02:15 PM
ado connection to access vs. sql server? Loane Sharp Excel Programming 7 November 16th 04 05:08 PM
Check for valid SQL server connection Robert W. King Excel Programming 1 September 8th 04 09:29 AM
ODBC connection for insert into SQL Server nevada Excel Programming 1 February 23rd 04 04:14 PM
sql server connection Andy Wiggins[_3_] Excel Programming 0 January 27th 04 08:40 AM


All times are GMT +1. The time now is 01:26 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"