Good Morning Guys/Gals.
Need some help with this. How long does it take to dispose of da and confdt?
What im trying to say is, that this function works fine if i execute it every 5 seconds or so, giving it enough time to close the controls, but if I execute this in a short amount of time, i am face with this error: "ERROR [HY000] [Microsoft][ODBC Text Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data."
Is it really a time issue? Can it be that the process is creating another instance of itself, eventually queuing up in task manager? if it is the process, what would its name be so that i can kill it everytime i need to dispose of it? Or do I need to force a Garbage Collect on it?
private void RowCount()
{
DataTable ConfDT = new DataTable();
string tempPath = @"C:\Download Report Sheets\";
string strConn = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + tempPath + @"\;Extensions=asc,csv,tab,txt";
OdbcConnection conn = new OdbcConnection(strConn);
OdbcDataAdapter da = new OdbcDataAdapter("Select * from Releases.csv", conn);//TestFile
conn.Open();
da.Fill(ConfDT);
ConfigGrid.DataSource = ConfDT;
ConfigGrid.Columns[0].DefaultCellStyle.Format = "G";
conn.Close();
}
Many Thanks