make a static class
class ClsMain
{
public static SqlConnection Con = null;
}
make a fuction to make connection
public static SqlConnection GetConnection(string connectionString)
{
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
return connection;
}
use this line initialize connection
clsMain.Con=GetConnection("connection string");