Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Query problem
Fri, Apr 25 2014 5:05 AMPermanent Link

Paul Waegemans

IMS bvba

Avatar

At designe time I've made a query as follows:

SELECT * FROM SEMINARIESDETAIL
WHERE inschrijven=true
AND datum>={datum='2014-01-01'}
ORDER BY datum ascending

at runtime I do the following:

v_testdatum:=DateToStr(date,false);  
/// through a showmessage(v_testdatum) I can see that the date in v_testdatum is correct ///

with SeminarsToCome1 do
       begin
       params.clear;
       Params.Add('inschrijvingen=true');
       Params.Add('datum>='''+V_testdatum+'''');
       end;

but the query is still working with the date that was set at design time and is also showing the seminars with date less than v_testdatum

Any suggestion?
Fri, Apr 25 2014 6:15 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Paul,

Is the line :

WHERE inschrijven=true

actually a parameter, it looks like a hard coded "true" value to me.
If this is the case then your parameter counts will be out when entering
your date values.


Chris Holland
[Team Elevate]

On 25/04/2014 10:05, Paul Waegemans wrote:
> At designe time I've made a query as follows:
>
> SELECT * FROM SEMINARIESDETAIL
> WHERE inschrijven=true
> AND datum>={datum='2014-01-01'}
> ORDER BY datum ascending
>
> at runtime I do the following:
>
> v_testdatum:=DateToStr(date,false);
> /// through a showmessage(v_testdatum) I can see that the date in v_testdatum is correct ///
>
> with SeminarsToCome1 do
>          begin
>          params.clear;
>          Params.Add('inschrijvingen=true');
>          Params.Add('datum>='''+V_testdatum+'''');
>          end;
>
> but the query is still working with the date that was set at design time and is also showing the seminars with date less than v_testdatum
>
> Any suggestion?
>
Fri, Apr 25 2014 6:27 AMPermanent Link

Matthew Jones

>         Params.Add('inschrijvingen=true');
>         Params.Add('datum>='''+V_testdatum+'''');

The first value name doesn't match your query name.
The second one has the condition in, and I think should just be '=' not the >=. I
ponder the added quotes too, but don't use this part so not sure.

/Matthew Jones/
Fri, Apr 25 2014 7:02 AMPermanent Link

Paul Waegemans

IMS bvba

Avatar

Hello Matthew,
Hello Chris,

Changing the code as Chris suggested
with SeminarsToCome1 do
       begin
       params.clear;
       Params.Add('datum>='''+V_testdatum+'''');
       end;

= result remains the same!

"inschrijvingen=true" is indeed not a parameter and there is no need to treat it as a parameter of course.

SOLUTION: removing >  as Matthew suggested gives the correct result.

Logic of course because we are only sustituting the value of the date.

MANY THANKS.  Sometimes you are to close to see what you are doing wrong.

Paul.




(Matthew Jones) wrote:

>         Params.Add('inschrijvingen=true');
>         Params.Add('datum>='''+V_testdatum+'''');

The first value name doesn't match your query name.
The second one has the condition in, and I think should just be '=' not the >=. I
ponder the added quotes too, but don't use this part so not sure.

/Matthew Jones/
Fri, Apr 25 2014 8:42 AMPermanent Link

Uli Becker

Paul,

your "date" syntax is not correct for EDB, please see this post:

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=4364#4364

You have to "declare" the string as date.

Uli

Image