6 Years
Discussion Span
Last Post by AndreRet

Yes it's possible.
Assuming that you have a module, in the module declare a connection object. You can either use the SQL Native Provider or use the OLE DB database Provider.
An example. The server name is Tana and I have a database named WaterPro. we will be connecting to the database using a user named Manager whose password is LetItGoN0w.

    strUserName = "Manager"
    strPassword = "LetItGoN0w"

    Set cnxWaterPro = New ADODB.Connection
    cnxWaterPro.CommandTimeout = 0
    cnxWaterPro.ConnectionString = " PROVIDER=SQLOLEDB" & _
        ";SERVER=Tana" & _
        ";UID=" & strUserName & _
        ";PWD=" & strPassword & _

Above example uses the SQL OLE DB provider. To make it use the native provider change the Provider directive to be SQLNATIVE. If using SQL Server 2008 then that will be Provider=SQLNCLI10.1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.