How to set "Application Name" in ADODB connection string

12,682

The correct keyword to set the application name in an ADODB connection string in VBA is APP, not Application Name.

Example connection string, copied from an MS Access app I'm working on:

DRIVER={SQL Server};SERVER=xxxx;DATABASE=xxxx;Trusted_Connection=Yes;APP=xxxx
Share:
12,682
SysDragon
Author by

SysDragon

.NET developer and musician. #SOreadytohelp profile for SysDragon on Stack Exchange, a network of free, community-driven Q&A sites http://stackexchange.com/users/flair/2228942.png

Updated on June 05, 2022

Comments

  • SysDragon
    SysDragon almost 2 years

    In .NET I simply use Application Name = MyApp inside the connection string, but when using ADO connection through VBA the Activity Monitor of the SQL Server Management Studio always shows Microsoft Office 2010 in Processes on the Application column no matter what name I set on the VBA code.

    conn.ConnectionString = "UID=" & UID & ";PWD=" & PWD & ";DSN=" & DSN & _
        ";Application Name = MyApp"
    

    How can I set the application name for monitoring purposes?