12345678910111213141516171819202122232425262728293031323334353637 |
- using MySql.Data.MySqlClient;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Hammer_store
- {
- internal class DB
- {
-
- MySqlConnection connection = new MySqlConnection("server=<server_name>;username=<user_name>;password=<password>;database=<name_database>");
-
- internal void openConnection()
- {
-
- if (connection.State == System.Data.ConnectionState.Closed)
- connection.Open();
- }
-
- internal void closeConnection()
- {
- if (connection.State == System.Data.ConnectionState.Open)
- connection.Close();
- }
-
- internal MySqlConnection getConnection()
- {
- return connection;
- }
- }
- }
|