grip003 Posted May 16, 2006 Posted May 16, 2006 I am having a major memory problem. I am loading a DataTable from a MySQL database, but when I dispose the DataTable, no memory is freed. I need to open about 70 tables and dump all the records into another database, but I keep getting an out of memory problem. Can anyone tell me how to completely empty a DataTable from memory? Here is the function I use to load my table: public DataTable SelectSQL_DT(string selectStr, string dtName) { try { MySqlConnection dbConnection = new MySqlConnection(connectionString); dbConnection.Open(); MySqlDataAdapter adapter = new MySqlDataAdapter(selectStr, dbConnection); DataTable my_table = new DataTable(dtName); adapter.Fill(my_table); // Dispose of the adapter, it is no longer needed adapter.Dispose(); dbConnection.Close(); dbConnection.Dispose(); return my_table; } catch (MySqlException e) { throw new Exception("SQL statement execution " + "error!!\n\n" + "Trying statement:\n " + selectStr + "\n\n" + e.Message); } } //end SelectSQL_DS(string selectStr, string dsName) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.