How to get server name through code if SQL Server (Standard Edition) is installed.
We pass the server name while creating a connection string to connect SQL Server. Can we retrieve this value through code?
string sqlConnectionString = string.Format(
"user id={0};password={1};server={2};Trusted_Connection=no;database=TestDB;
connection timeout={3}",
dirDBinfo.UserName, dirDBinfo.Password, "ServerName", dirDBinfo.TimeOut);