You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using MySql.Data.MySqlClient;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace EPAServeur.BDAccess
|
|
|
|
|
{
|
|
|
|
|
public class BDAccess
|
|
|
|
|
{
|
|
|
|
|
private static BDAccess instance = null;
|
|
|
|
|
private MySqlConnection connection;
|
|
|
|
|
|
|
|
|
|
private BDAccess()
|
|
|
|
|
{
|
|
|
|
|
MySqlConnectionStringBuilder infoConnection = new MySqlConnectionStringBuilder()
|
|
|
|
|
{
|
|
|
|
|
Server = "digitepa_db",
|
|
|
|
|
Port = 3306,
|
|
|
|
|
Database = "database_ep",
|
|
|
|
|
UserID = "dev",
|
|
|
|
|
Password = "dev"
|
|
|
|
|
};
|
|
|
|
|
this.connection = new MySqlConnection(infoConnection.ConnectionString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static BDAccess getInstance()
|
|
|
|
|
{
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static MySqlDataReader executeQuery(string query)
|
|
|
|
|
{
|
|
|
|
|
if (instance == null)
|
|
|
|
|
{
|
|
|
|
|
instance = new BDAccess();
|
|
|
|
|
}
|
|
|
|
|
instance.connection.Close();
|
|
|
|
|
instance.connection.Open();
|
|
|
|
|
|
|
|
|
|
MySqlCommand command = new MySqlCommand(query, instance.connection);
|
|
|
|
|
return command.ExecuteReader();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|