Jump to content

zinpub

Members
  • Content Count

    9
  • Joined

  • Last visited

Posts posted by zinpub


  1. Can't get log file from FastMM5...  Maybe someone can explain what I'm doing wrong?

    Delphi 11

    program Project4;
    
    uses
      FastMM5,
      System.StartUpCopy,
      FMX.Forms,
      SysUtils,
      Unit4 in 'Unit4.pas' {Form4};
    
    {$R *.res}
    
    begin
      FastMM_LogToFileEvents := [mmetDebugBlockDoubleFree,
        mmetDebugBlockReallocOfFreedBlock, mmetDebugBlockHeaderCorruption,
        mmetDebugBlockFooterCorruption, mmetDebugBlockModifiedAfterFree,
        mmetVirtualMethodCallOnFreedObject,
        mmetAnotherThirdPartyMemoryManagerAlreadyInstalled,
        mmetCannotInstallAfterDefaultMemoryManagerHasBeenUsed,
        mmetCannotSwitchToSharedMemoryManagerWithLivePointers];
    
      FastMM_SetEventLogFilename('D:\log.txt');
    
      FastMM_EnterDebugMode;
    
      ReportMemoryLeaksOnShutdown := True;
    
      Application.Initialize;
      Application.CreateForm(TForm4, Form4);
      Application.Run;
    end.

     


  2. function TForm7.StrToDateFrmt(const iFormat, iDateStr: string): TDateTime;
    var
      AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word;
      aPos: Integer;
    
      procedure InitVars;
      begin
        AYear := 1;
        AMonth := 1;
        ADay := 1;
        AHour := 0;
        AMinute := 0;
        ASecond := 0;
        AMilliSecond := 0;
      end;
    
      function GetPart(const iPart: Char): Word;
      var
        aYCnt: Integer;
      begin
        Result := 0;
        aYCnt := 0;
    
        while (aPos <= High(iFormat)) and (iFormat.Chars[aPos + aYCnt] = iPart) do
          inc(aYCnt);
    
        Result := StrToInt(iDateStr.Substring(aPos, aYCnt));
    
        aPos := aPos + aYCnt;
      end;
    
    begin
      InitVars;
      aPos := 0;
    
      while aPos <= High(iFormat) do
      begin
        case iFormat.Chars[aPos] of
          'Y':
            AYear := GetPart('Y');
          'M':
            AMonth := GetPart('M');
          'D':
            ADay := GetPart('D');
          'H':
            AHour := GetPart('H');
          'N':
            AMinute := GetPart('N');
          'S':
            ASecond := GetPart('S');
          'Z':
            AMilliSecond := GetPart('Z');
        else
          inc(aPos);
        end;
      end;
    
      Result := EncodeDateTime(AYear, AMonth, ADay, AHour, AMinute, ASecond,
        AMilliSecond);
    end;

     


  3. On 12/24/2018 at 7:50 AM, JDS2018 said:

    This is the code but still same error

     

    Query.SQL.Add('Delete  From Ledger');
     Query.SQL.Add('Where LedgerDate between  '''+StartDate+ '''  AND  '''+EndDate+'''');

    Is there space before "Where" or after "Ledger" ?  Try print in one string ....

     

    const

      sSql = "Delete from Ledger where LedgerDate between %s and %s";

     

    Query.Sql.Text:= Format(sSql, ['01.01.2019', '01.01.2019']);

     

     


  4. 10 minutes ago, Alexander Elagin said:

    What if those fields (TField instances) belong to some already destroyed component? Then the FieldByName references may point to some garbage. Or there are simply no fields with such names, then FieldByName returns nil and AsFloat produces an AV. Just guessing.

    FieldByName raise Exception if there are no fields with such names. FindField return nil

×