Question .NET Datetime input Parameters ???

Anki

New Member
Hi, im currently developing and .net client application, but when i passing datetime values in .net as input parameter to an dataset in Progress it doesnt work. Here is my code:

Code:
DEFINE TEMP-TABLE ttJob LIKE JOB.
DEFINE DATASET JobInfo FOR ttJob.

DEFINE INPUT PARAMETER vDate AS DATE.
DEFINE OUTPUT PARAMETER DATASET FOR JobInfo.
DEFINE OUTPUT PARAMETER sError AS CHAR FORMAT "x(20)" INITIAL "".

DEF VAR retok AS LOG.
DEF VAR hJobOrdLin AS HANDLE.
DEF VAR hqJob AS HANDLE.

DEFINE QUERY qJOB FOR JOB.
hqJob = QUERY qJOB:HANDLE.
retok = hqJob:QUERY-PREPARE("for each JOB where  job.DATE_req < vDate").

IF NOT retok THEN DO:
    sError = "No Data" .
    RETURN.
END.

In the QUERY-PREPARE command, if i put vDate in the query ill get a blank dataset in .net. However, if i put TODAY instead of vDate it returns a valid dataset.
retok = hqJob:QUERY-PREPARE("for each JOB where job.DATE_req < TODAY").
Is there anyway for me to solve this problem?
 
Last edited by a moderator:

RealHeavyDude

Well-Known Member
If I were you I would code something like this:
Code:
retok = hqJob:query-prepare ( substitute ( 'for each JOB where job.DATE_req < "&1"', vdDate ) ).
You must substitute the contents of the variable at runtime - not at design time. It works with today because this a date value not the name of a variable.

On a side note: I don't see any .NET relevant code in your sample.

Heavy Regards, RealHeavyDude
 

Anki

New Member
Problem is solved. You are right RealHeavyDude, the contents of the variable at runtime is incorrect.
Regards.
 
Top