Jump to content

zinpub

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Well, the transformation of the "any - possible" date is not a task for one function 🙂
  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. zinpub

    Delete Error With Delphi and Access Table

    just saw ! Your SQL is 'ID Delete from Ledger ..... ' 🙂
  4. zinpub

    Delete Error With Delphi and Access Table

    Much better use ParamByName
  5. zinpub

    Delete Error With Delphi and Access Table

    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']);
  6. zinpub

    Releasing memory devoted to arrays

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