1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
   |  
void __fastcall TForm1::BtnFindClick(TObject *Sender)
{
    TLocateOptions Ops;
    TDateTime      Begin,End;
    bool           bResult;
 
    //--- Options de recherche
    switch (FFldRef->DataType) {
        case ftString:
            Ops = TLocateOptions() << loCaseInsensitive << loPartialKey;
            break;
        default:
            Ops = TLocateOptions();
    }// End Switch
   //--- Prendre le temps de Debut
    Begin = Time();
    //--- Recherche par locate
    bResult = ABSTable1->Locate(FFldRef->FieldName,FldFind->Text,Ops);
    //--- Prendre le temps de fin de recherche
    End = Time();
    //--- Afficher le resultat
    if (bResult)
        MessageDlg("Enregistrement trouvé", mtWarning, TMsgDlgButtons() << mbOK, 0);
    else
        MessageDlg("Enregistrement non trouvé", mtWarning, TMsgDlgButtons() << mbOK, 0);
    //--- Affichage du temp
    FldTime->Caption = IntToStr(MilliSecondOf(End-Begin));
} |