ADO Performance / Optimize?

From: Todd Jaspers (tjaspers_at_bellsouth.net)
Date: 07/13/04

  • Next message: jason: "Strange problem"
    Date: Tue, 13 Jul 2004 08:06:47 -0500
    
    

    Hey guys,

        I am using ADO components on a client-server application written in
    Delphi 7. I am connecting to a Sybase Database using DataDirect drivers. I'm
    curious if someone could give me some sort of an idea how I can optimize the
    processing time of my program?

    Basically, this program pulls lots of data ( a bunch of keys, really ) from
    a MAIN table in the database. Then, it queries multiple other tables
    throughout the process. I'm wondering if I'm putting some unnecessary steps
    in there and what I can do to help fix this problem.

    Below is a typical example of one of my queries:

      Function TCP_Main_Frm.CheckAcc(FormatSpec: String) : String;
      Var
        SQLStatement : String;
      Begin
        SQLStatement :=
             ('SELECT T1.specimen_id, T1.specnum_formatted '
            + 'FROM c_specimen T1 '
            + 'WHERE T1.specnum_formatted = "' + FormatSpec + '"');

        CPXML_DATA.DM.CP_Query.SQL.Clear;
        CPXML_DATA.DM.CP_Query.SQL.Text := SQLStatement;
        CPXML_DATA.DM.CP_Query.Active := True;
        Result := CPXML_DATA.DM.CP_Query.FieldByName('specimen_id').AsString;
        CPXML_DATA.DM.CP_Query.Active := False;
        CPXML_DATA.DM.CP_Query.SQL.Clear;
      End;

    I'm posting this because I hope you'll take notice of the ACTIVE = TRUE and
    then ACTIVE = FALSE commands that I use. Is there a better way? Do I really
    need to active / inactivate the query component each time? Or can I leave
    the query active the entire time, and just execute it?

    Thanks!

    Todd


  • Next message: jason: "Strange problem"