🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #203

too many open tables error

#203
From: Antonio Eligio Perez Moron
Date: Fri, 14 May 2004 07:28
73 lines
2622 bytes
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
Technical Details
Message-ID: <40a47477@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,dcb127015d948635,start
X-Google-Attributes: gidfcd2b,public
From: "Antonio Eligio Perez Moron" <eperez@acisa.es>
Newsgroups: borland.public.cppbuilder.database.multi-tier
Subject: too many open tables error
Date: Fri, 14 May 2004 09:28:15 +0200
Lines: 76
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 213.227.24.134
Message-ID: <40a47477@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1084519543 213.227.24.134 (14 May 2004 00:25:43 -0700)
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail