Forum Discussion

Babulu's avatar
Babulu
Contributor
5 years ago

Unable to Connect to SQLSERVER14 Database in VB script connection is not open in Windows Authentific

Function objOpenADODBConnectionToDBSSPI(m_strDBServer, m_strDBName)

'Declare Variables
Dim objConn

'create the ADODB.Connection and Open the connection
Set objConn = CreateObject("ADODB.Connection")

'Connection String

objConn.ConnectionString = "Provider=SQLOLEDB;Data Source=" & m_strDBServer & ";Initial Catalog=" & m_strDBName & ";Integrated Security=SSPI;"

objConn.Open

'Return the Connection Object
Set objOpenADODBConnectionToDBSSPI = objConn

'Reltease memory from the objec
Set objConn = Nothing

End Function