Hi you can declare constring and connection object globally as below
First you need to add key in the
app.config file as shown below
<br />
<br />
<appSettings><br />
<br />
<add key="DbConnectionString" value="database=pubs;user Id=sa;password=sa"/><br />
<br />
</appSettings><br />
then in the C# code behind file include the namespace
using System.Configuration;
then read the connection string from app.config as below
static readonly string DB_CONN_STRING = ConfigurationManager.AppSettings["DbConnectionString"];