Anything They Can Do Why can't you?

5Oct/091

Application Name in .net Connection Strings

Ever want to check to see how data got into your database? I know that at times I will fire up SQL Managment Studio and make some changes when I need to we all do it. Here is a nice little trick that you can put in a trigger on sensitive tables to record what application told the database to update/insert. the below will yield you what ever value you put in the Application Name parameter in the connection string. I got in the habit of auto appending this to the connection strings stored in my app.config and web.config files in compiled code so that if I need to I can see what program is connecting and with what credentials.

SELECT APP_NAME()

Go ahead load up SQL Server Managment Studio and run that query you should get "Microsoft SQL Server Management Studio - Query"

Comments (1) Trackbacks (0)
  1. Shoot, so that’s that one supopess.


Leave a comment


No trackbacks yet.