我需要在ADODB连接中添加用户名和密码
With cn
.ConnectionString = "DRIVER={SQL Server}; " & _
" SERVER=MyServerName;" & _
" DATABASE=db;" & _
" Trusted_connection=YES"
.Open
End With
答案 0 :(得分:1)
这是查找可能的连接字符串的好资源:https://www.connectionstrings.com/sql-server/
您可以尝试例如:
With cn
.ConnectionString = "DRIVER={SQL Server}; " & _
" SERVER=MyServerName;" & _
" DATABASE=db;" & _
" User Id=myUsername;" & _
" Password=myPassword"
.Open
End With