How To Make A Trusted SQL Server DSNLESS Connection

Article translations Article translations
Article ID: 194641 - View products that this article applies to.
This article was previously published under Q194641
Expand all | Collapse all


When connecting to a Microsoft SQL Server using a DSN, an option or checkbox (depending on the version of the ODBC Driver) is available to use a Trusted Connection (or Integrated Security).

This option is not available as a parameter for DSNLESS connections.


To make a DSNLESS connection using a trusted connection to SQL Server, set the UID and PWD parameters equal to NULL. This will force the ODBC driver to connect using a trusted connection instead of SQL Server Authentication.

Below is an example of the connection string needed to create a Trusted Connection:
  Dim Connect As String
  Connect="Driver={SQL Server};Server=TestServer;Database=Pubs;UID=;PWD="



For more information about connecting to Microsoft SQL Server or database technology please refer to your Microsoft Visual Basic documentation or visit the Universal Data Access Web site at:


Article ID: 194641 - Last Review: July 1, 2004 - Revision: 3.2
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 4.0 Standard Edition
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
kbhowto KB194641

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from