protected async Task<DataTable> ExecuteQuery(string query, params MySqlParameter[] mParams)
{
return await Task.Run(() =>
{
using (MySqlConnection conn = new MySqlConnection(ConnectionString))
{
conn.Open();
using (MySqlCommand cmd = new MySqlCommand(query, conn))
{
foreach (var param in mParams)
cmd.Parameters.Add(param);
var reader = cmd.ExecuteReader();
var dt = new DataTable();
dt.Load(reader);
conn.Close();
return dt;
}
}
});
}