C # "There is already an open DataReader associated with this connection, which should be closed first

Possible Duplicate:
MultiThreading Error: The DataReader associated with this connection is already open and should be closed first

I'm not sure why I still have a problem, here is my code below, any help is appreciated.

public static DataTable DTTable (string mysqlQuery, string queryName)
        {
            lock (_object)
            {
                DataTable DTTableTable = new DataTable ();
                try
                {
                    using (MySqlDataAdapter DataDTTables = new MySqlDataAdapter (mysqlQuery, MySQLProcessing.MySQLStatic.Connection))
                    {
                        using (DataTable DataDTTablesDT = new DataTable ())
                        {
                            DataDTTables.SelectCommand.CommandTimeout = 240000;
                            DataDTTables.Fill (DataDTTablesDT);
                            DTTableTable = DataDTTablesDT;
                            DataDTTables.Dispose ();
                        }
                    }

                }
                catch (Exception ex)
                {

                    GenericLogging ("Failed MySQLquery:" + ex.Message.ToString (), "MySQLProcessor", "DTTable", "", "MysqlError", "", queryName, mysqlQuery);

                }
                return DTTableTable;
            }
        }
+1
source share

All Articles