ADP Application Name in Connection String

  • Thread starter Thread starter Charlie Gillis
  • Start date Start date
C

Charlie Gillis

In my Data Project I'd like to pass the Application Name to SQL Server. I
can do
this with the default ADP Connection (File->Connection->All - Application
Name), but my app requires a disconnected startup and a manual connection
string.
Here's the connection string:

"Provider=SQLOLEDB;Application Name=MyApp;Network Library=DBMSSOCN;Data
Source=MySqlSvr;Initial Catalog=MyDB;user id=myUid;password=myPwd

The connection succeeds but SQL Profiler shows 'Microsoft Office 2003' as
the Application Name on the connection, not 'MyApp'.

How can I make this work?
 
I remember I once had a support incident on this issue. The response from MS
was: you can't.

Vadim Rapp
 
That's been my experience as well. Access makes SEVERAL connections to SQL
Server in some instances, and one of them will pretty much always be
"Microsoft Office <whatever version>". If you establish additional
ADODB.Connection objects, however, your application name will be respected
for those connections.


Rob
 
Having just posted that you can't, it occurs to me that you might be able to
change the Application Name using Application.CurrentProject.OpenConnection.
Give it a shot and see if it works. It's a little redundant, since you'll
be opening the connection once natively, then once in your code, but it
might get you where you're going.


Rob
 
Rob,
Access doesn't want to play nice with this. It's as though he is parsing my
connection string and ignoring 'Application Name'.
I can connect, then reconnect and each time the new connection has the
default application name.

This apple is too high up in the tree....
Thanks again.

Charlie
 
Yes, you are right: Access doesn't use your connection string because it
doesn't open the JET or SQL-Server OLEDB provider directly. Instead, it
uses (and opens) an intermediary provider called « Microsoft Access OLEDB
Provider 10 » and this is this later provider that opens the JET or
SQL-Server Oledb provider. Obviously, the ApplicationName doesn't seem to
be passed on to this intermediary provider.

For more information on this topic, see:
http://support.microsoft.com/default.aspx?scid=kb;281784
 
Back
Top