class DB { private MySqlConnection connection = new MySqlConnection("server=localhost;port=3306;username=root;password=password;database=database"); public void openConnection() { if(connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } } public void closeConnection() { if (connection.State == System.Data.ConnectionState.Closed) { connection.Close(); } } public MySqlConnection getConnection() { return connection; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)