Home > Software engineering >  Database connection prompt the user sa login failed, not associated with a trusted SQL Server connec
Database connection prompt the user sa login failed, not associated with a trusted SQL Server connec

Time:10-10

Public () Function Cnn As ADODB. Connection 'definition Function
Set the Cnn=New ADODB. Connection
'return a database connection
Cnn. Open "Driver={SQL Server}; Server=(local); The Database=db_mainHR; Uid=sa; The Pwd="
End the Function
The Public Function cnStr () As String
CnStr="Provider=SQLOLEDB. 1; Integrated Security=SSPI; Persist Security Info=False; User ID=sa; Initial Catalog=db_mainHR; Data Source=computer name "
End Function

CodePudding user response:

Conn. The ConnectionString="driver=SQL Server; Server=computer name or IP address; Uid=SA; The PWD=SA password; The database=database name "
Conn. Open
  • Related