using System.Data.SqlClient; using System.Configuration; namespace hello42_win { public class Dbconnection : Form { SqlConnection sqlConn; public SqlConnection OpenConnection() { sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString); if (sqlConn.State != ConnectionState.Open) { sqlConn.Open(); } return sqlConn; } public SqlConnection CloseConnection() { if (sqlConn.State != ConnectionState.Closed) { sqlConn.Close(); } return sqlConn; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)