@Balaji Pooruli , I suggest that you could define a global variable in your class.
Like the following:
public class DbHelper
{
public readonly static string connstr = "Data Source=VXXSAMXXX01\DEV1;Initial Catalog=SAMXX_DEV;Integrated Security=True";
}
Then, you could access the string directly:
SqlConnection connection = new SqlConnection(DbHelper.connstr);
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.