OleDbDataAdapter OutOfMemoryError and NullReference

  • Thread starter Thread starter pascal
  • Start date Start date
P

pascal

Hi,

I am loading an Access table using an OleDbDataAdapter and calling the
Fill method on a datatable. Then I display the records using a dataview
and apply some filters.
If I want to reload the datatable by calling OleDbDataAdapter.Fill on
the same DataTable it launches OutOfMemory or NullReference exceptions.
If before the call to Fill, I call Reset on the DataTable it works OK.
My question is what is the Reset method doing to the DataTable?
What is causing this strange error?

Thanks,
Diablo
 
Can you post some code on what your doing? Its hard to tell what could
be going wrong without checking the code.

NuTcAsE
 
Hi, here is the code (the field names are not english, sorry):

public DataView ListaDocumente()
{
//dtCache.Reset();
dtCache.Clear();
dtCache.Columns.Clear();
selectCmd.CommandText = "SELECT ID_Document, Denumire, Autor, Data,
Descriere, Stocare, Cale, Exemplare, Info, Destinatie, Foi, Pagini,
Observatii, Tiparit, Utilizatori.Nume + ' ' + Utilizatori.Prenume AS
Utilizator, Documente.ID_Utilizator AS ID_Utilizator FROM Documente
INNER JOIN Utilizatori ON Documente.ID_Utilizator =
Utilizatori.ID_Utilizator WHERE Documente.Activ = Yes";
try
{
adapter.Fill(dtCache);
}
catch (OleDbException e)
{
MessageBox.Show("Err: " + e.Message, "Err");
}
DataView dvDocumente = new DataView(dtCache);
dvDocumente.AllowNew = false;
return dvDocumente;
}
public void Test()
{
DataView dv = ListaDocumente();
dv.RowFilter = "Denumire LIKE '*CO*'";
dv = ListaDocumente();
}

If i call Test() it works OK! Then try to call it again, and it fails
launching nullreference exception in adaptor.Fill().
If i uncomment the Reset() line, it works OK. Why?
Any help is highly apreciated!

Diablo
 
Back
Top