0

Dear Experts

How to findout computer / server name with vb.net codes.

I want to use it in connection string

con = New Data.SqlClient.SqlConnection("Data Source=noor;" & _
                  "Initial Catalog=accounts;Integrated Security=True")

Please help

Edited by Nick Evan: Added code-tags

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by sknake
0

You can get the client computer name with Environment.MachineName .

To get the SQL Server's name you can submit this query:

Select Cast(@@SERVERNAME as varchar)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.