delphiadoconnection

How to set Application Name property of a TADOConnection in Delphi?


I have a Delphi app that connects to a MS SQL server using TADOConnection.
Now I need to set "Application Name" property of a TADOConnection (so that it could be seen on DB with select distinct program_name from sys.sysprocesses query).

TADOConnection does not have a ApplicationName property. Instead it just internally assigns application executable name to it (which can be seen with a query above).

How do I set "Application Name" property of a TADOConnection connection with MS SQL database?


Solution

  • "Application Name" property (and others) can be set like so:

    AdoConnection1.Properties['Application Name'].Value := 'MyAppName';