Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

ReportBeforeOpenDataPipelines

edited December 2007 in RAP
Hello.



procedure ReportBeforeOpenDataPipelines;
var
lSQLBuilder: TdaSQLBuilder;
begin
lSQLBuilder := TdaSQLBuilder.Create(Koder);
lSQLBuilder.SearchCriteria.AddAutoSearch('Koder','kdFra',
'>=',Report.AutoSearchFields[1].SearchExpression);
lSQLBuilder.SearchCriteria.AddAutoSearch('Koder','kdFra',
'<=',Report.AutoSearchFields[2].SearchExpression);
lSQLBuilder.ApplyUpdates;
lSQLBuilder.Free;
end;

I have this event i my report to add some searchcriteria for a pipeline on a
subreport. I get an sql-error when i attempt to
run it. The query that fails looks like this.....

SELECT Koder.kdKode, Koder.kdTil, Koder.kdFra
FROM Koder Koder
WHERE ( Koder.kdFra >= #2008-02-15 00:00:00# )
AND ( Koder.kdFra <= #2008-02-22 00:00:00# )
ORDER BY Koder.kdFra

Both AutoSearchFields is a datetime field. What is wrong?


Best regards
Terje Syversen

Comments

  • edited December 2007

    For future reference please specify environment details.

    Are you using MS Access? For MS Access a datetime literal in a SQL statement
    will look like

    #2008-02-15 00:00:00#


    SQL for datetime literlas are not standardized across database products. If
    you are /not/ using MS Access, then you need to specify the
    Designer.DataSettings.DatabaseType to be something else.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.