SQL ProgramName

  • Thread starter Thread starter Backwards
  • Start date Start date
B

Backwards

If i run a SP_who/SP_who2 on my SQL 2000 database to see whos running
what programs, i'm finding a lot of these are only showing ".Net
SqlClient Data Provider" as the program name rather than for example
"My SQL app 1"

We are using VB.net 2.0 with Visual studio 2005, is there a setting i
need to change somewhere for this or some code i can insert into my
app to change its name in the SQL database?

I have seen this done in older versions but i dont know how to do so.

Regards,

Andy
 
www.ConnectionStrings.com is your friend.

You have to set it in the applications connectionstring

Application Name="Your App Name"

The name of the application, or '.Net SqlClient Data Provider' if no
application name is provided.
 
Dim message As String = "Data Source=" + Me.ComboBox1.Text.ToString() +
";Initial Catalog=northwind;Integrated Security=SSPI"
Dim sql As New SqlClient.SqlConnection(message)
sql.Open()

Thats my current connection string. When i try add the following it
doesnt like it:

Dim message As String = "Data Source=" + Me.ComboBox1.Text.ToString() +
";Initial Catalog=northwind;Integrated Security=SSPI"
Dim sql As New SqlClient.SqlConnection(message)
sql.application_name = "Example App1"
sql.open()

Any thoughts?
 
Backwards,

Make it part of the connection string:

Dim message As String = "Data Source=" + Me.ComboBox1.Text.ToString() +
";Initial Catalog=northwind;Integrated Security=SSPI;Application
Name=Example App 1;"

Kerry Moorman
 
Back
Top