Interesting error in OleDbDataAdapter.Fill()

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

pascal

Hi, please have a look at the code below:

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
 
Pascal,

Often are those interesting errors because somebody is using a reserved SQL
word in his "data" base

Did you check for that, I am not known with all reserverd SQL words.

Cor
 
Back
Top