TrinityCore_Manager.Database.MySqlDatabase.ExecuteQuery C# (CSharp) Method

ExecuteQuery() protected method

protected ExecuteQuery ( string query ) : Task
query string
return Task
        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;

                    }

                }

            });

        }