zinpub
Members-
Content Count
9 -
Joined
-
Last visited
Everything posted by zinpub
-
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.
-
Yes procedure TForm4.btnClick(Sender: TObject); begin TStringList.Create; end; FastMM4 catches them.
-
String to Date conversion (yet another one)
zinpub replied to ertank's topic in RTL and Delphi Object Pascal
Well, the transformation of the "any - possible" date is not a task for one function 🙂 -
String to Date conversion (yet another one)
zinpub replied to ertank's topic in RTL and Delphi Object Pascal
requires minimal refinement -
String to Date conversion (yet another one)
zinpub replied to ertank's topic in RTL and Delphi Object Pascal
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; -
just saw ! Your SQL is 'ID Delete from Ledger ..... ' 🙂
-
Much better use ParamByName
-
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']);
-
FieldByName raise Exception if there are no fields with such names. FindField return nil