79a Subj : too many open tables error To : borland.public.cpp.borlandcpp From : Antonio Eligio Perez Moron Date : Fri May 14 2004 10:27 am my code : TForm1::LeeHistoricos(TDateTime fecha_hora_inicial,TDateTime fecha_hora_final,unsigned short entrada,unsigned char tipo_entrada) { TQuery * TablaDatos = new TQuery(NULL) ; String consulta; String select; try { try { // TablaDatos->Close(); consulta = " fechahora >= '" + fecha_hora_inicial.FormatString("mm/dd/yyyy hh:nn") + "' and fechahora <= '" + fecha_hora_final.FormatString("mm/dd/yyyy hh:nn") + "' and NUMEROENTRADA = " + IntToStr(entrada) ; // + " order by fechahora " ; TablaDatos->SQL->Clear(); select = "select * from 'F:\\ely\\PROYECTOS ELY\\PROYECTO REMOTA\\ERU\\BASEDATOS\\DTA.db' where " + consulta ; TablaDatos->SQL->Add(select); TablaDatos->ExecSQL(); TablaDatos->Open(); if (!TablaDatos->Eof) TablaDatos->First(); while (!TablaDatos->Eof) { TablaDatos->Next(); } // TablaDatos->Close(); } catch(Exception &e) { int i = 0 ; //TablaDatos->Close; // delete TablaDatos; // TQuery * TablaDatos = new TQuery(NULL) ; } } __finally { TablaDatos->Close(); Sleep(500); delete TablaDatos; } } void __fastcall TForm1::Button1Click(TObject *Sender) { for (int i = 0;i<500;i++) { LeeHistoricos((TDateTime) "13/05/2004 08:00",(TDateTime) "13/05/2004 09:00",2,2); Edit1->Text = i; Application->ProcessMessages(); } ShowMessage("end") ; } when i = 251 go to the catch code and the error is too many open tables. thank you Too many open tables error . 0