I am using the following function to open a SQL connection:
Public Function OpenADODb(sProvider As String, sServer As String, sDatabase As String, sUserId As String, sPassword As String) As ADODB.Connection
Const FORM_NAME = "cADO"
Dim oCn As New ADODB.Connection
Dim sCnStr As String
sCnStr = "Provider=SQLOLEDB + ';Server=actualserver;" & _
"Database=actualdb;User Id=xx;Password=xxxx;"
oCn.Open sCnStr
Set OpenADODb = oCn
EXIT_PROC:
Exit Function
End Function
What is the syntax for using the values I am passing instead of hardcoding them?
Thanks for your help!
Public Function OpenADODb(sProvider As String, sServer As String, sDatabase As String, sUserId As String, sPassword As String) As ADODB.Connection
Const FORM_NAME = "cADO"
Dim oCn As New ADODB.Connection
Dim sCnStr As String
sCnStr = "Provider=SQLOLEDB + ';Server=actualserver;" & _
"Database=actualdb;User Id=xx;Password=xxxx;"
oCn.Open sCnStr
Set OpenADODb = oCn
EXIT_PROC:
Exit Function
End Function
What is the syntax for using the values I am passing instead of hardcoding them?
Thanks for your help!