Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Passing dates as parameters in DelphiSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v8 Forum

 New Topic 
 
 Post Reply 
[1]  
 Passing dates as parameters in Delphi 
 Author   Message 
  GUL 
  
 Group: Members 
 Posts: 3 
 Joined: 2007-11-11 
 Profile
 Posted : 2007-12-09 09:23:55
Hello everyone...

How do I pass dates as parameters in Delphi ?

I must select transactions with dates older than MinDate but before MaxDate. I am doing this action:

...
var
 vMinDate, vMaxDate: tDateTime;

begin

 vMinDate := date - 15;
 vMaxDate := date;

 qCheques.close;
 qCheques.sql.clear;
 qCheques.sql.add('select PayeeEntityRefFullName,');
 qCheques.sql.add(' TxnDate,');
 qCheques.sql.add(' Amount,');
 qCheques.sql.add(' RefNumber,');
 qCheques.sql.add(' Memo,');
 qCheques.sql.add(' TxnNumber');
 qCheques.sql.add('from BillPaymentCheck');
 qCheques.sql.add('where TxnDate >= :MinDate and TxnDate <= :MaxDate');

 qCheques.paramByName('MinDate').asDateTime := vMinDate;
 qCheques.paramByName('MaxDate').asDateTime := vMaxDate;
 qCheques.open;
...

In this forum I found out that I must use {d 'YYYY-MM-DD'} and tryed it succesfully when I just run the query without parameters. For example:
select TxnDate from BillPaymentCheck where TxnDate >= {d '2007-11-01'} and TxnDate <= {d '2007-11-30'}

That works fine but I need to use parameters to select specific ranges at run time.

What do I need to do ?. Please help.

Best regards.
GUL 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-12-09 22:11:18

If you're just wanting 15 days before the current date, QODBC can do it for you instead:

qCheques.sql.add('where TxnDate >= {fn CURDATE()}-15) and TxnDate <= {fn CURDATE()}');

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to