  # zinpub

Members

7

## Community Reputation

0 Neutral
1. ## String to Date conversion (yet another one)

Well, the transformation of the "any - possible" date is not a task for one function 🙂
2. ## String to Date conversion (yet another one)

requires minimal refinement
3. ## String to Date conversion (yet another one)

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;
4. ## Delete Error With Delphi and Access Table

just saw ! Your SQL is 'ID Delete from Ledger ..... ' 🙂
5. ## Delete Error With Delphi and Access Table

Much better use ParamByName
6. ## 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']);
7. ## Releasing memory devoted to arrays

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