function TdmR3.GetCountForPeriod(LastDate: TDateTime; IsPlan: boolean): Integer; var qu: TADOQuery; S: String; begin qu:=TADOQuery.Create(nil); try S:=FormatDateTime('dd.mm.yy',LastDate); qu.ConnectionString:=WideString(Format(CONECT_STR,[db_file])); qu.SQL.Text:='select count(*) from DecadaVal as d where d.LastDate=:LastDate and IsPlan=:IsPlan'; qu.Parameters[0].Value:=LastDate; qu.Parameters[1].Value:=IsPlan; qu.Open; Result:=qu.Fields[0].AsInteger; finally qu.Free; end; end;