public static void openConnection() { try { if (SQLC.State == ConnectionState.Closed) { SQLC.ConnectionString = GetConnectionString(); SQLC.Open(); } } catch (Exception ex) { MessageBox.Show("Can't open SQL server"); } }