Hi Karen,
Is it the purpose of DetermineServer to simply define the connection string, and not the connection? If so, simply have the method return the connection string, without passing a connection object to it. Then use the returned connection
string to initialize the connection. Something like this should give you an idea:
Public Function DetermineServer(ByVal strConn As SqlConnection)
As String
' Do whatever you need to do here, building up APC_WirelessConnectionString
' as you currently do
' then return the connection stirng
Return APC_WirelessConnectionString
End Function
Since this code returns a connection string, you can initialize a connection object like this:
Dim strConn As New SqlConnection (DetermineServer())
With this code, DetermineServer is called first. It returns the proper connection string which is then passed to the constructor of the SqlConnection object.
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.