AsDate/AsDateTime help needed _desperately_ 
Author Message
 AsDate/AsDateTime help needed _desperately_

Hi all,

I have a TQuery with a SELECT-statement. This query needs some
parameters.

I have a Var called DateFrom of type TDateTime. I try this to pass to
a parameter of the TQuery with the following statement:

Query.ParamByName('DateFr').AsDateTime := DateFrom

Now when running the query I am getting no results back. After having
added watches and examining them I see the following:

DateFrom has something like the value 35065. This is correct since
TDateTime is a longint. (The date is 1-1-96)

Examining  Query.ParamByName('DateFr') reveals as something like:

($8A7150,'1-1-96'+ a lot of garbage,'DateFr',ftDateTime, False,True,
ptUnknown)

In other words AsDateTime goes haywire when converting. It's adding
garbage after the correct date. And what is even stranger, when using
AsDateTime in a TTable all goes well.
Table.FieldByName('DateFr').AsDateTime gives the correct date !

Any help or workaround needed _desperately_

MArk



Mon, 24 May 1999 03:00:00 GMT  
 AsDate/AsDateTime help needed _desperately_

Quote:

> Hi all,

> I have a TQuery with a SELECT-statement. This query needs some
> parameters.

> I have a Var called DateFrom of type TDateTime. I try this to pass to
> a parameter of the TQuery with the following statement:

> Query.ParamByName('DateFr').AsDateTime := DateFrom

> Now when running the query I am getting no results back. After having
> added watches and examining them I see the following:

It might not be the best solution but I am using AsString and it works
just great...

Sylvain.



Mon, 24 May 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Desperately need help

2. DESPERATELY IN NEED OF HELP!!

3. Help: TProtect files needed desperately

4. DESPERATELY NEED HELP WITH SECONDARY INDEXES AND CHILD DATABASES

5. DESPERATELY NEED HELP on TQuery

6. Desperately needed code

7. Desperately Need Code

8. Steam Tables DESPERATELY Needed

9. Steam Tables DESPERATELY Needed

10. assign null to AsDateTime parameter

11. AsDateTime wierd behaviour

12. Desperately seeking database

 

 
Powered by phpBB® Forum Software