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

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)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.