i m facing a problem using filter option of TAdoQuery object. String in filters work fine but when i try to use filter on dates, it throws an exception.
i m trying to fetch records from database using TADOQuery object and then applying filters at runtime. Problem occurs when i apply filter on date column. i have a table named orders, and there is a column orderDate. Now when i need to apply filter to get orders between two given dates, i do following steps;
qryOrders.filter := 'OrderDate between ''' + DateToStr(dtPkr1.Date) + ''' and ''' + DateToStr(dtPkr2.Date) + '''';
qryOrders.filtered := true;
when code executes, following EOleException is thrown:
"Arguments are of wrong type, are out of acceptable range or are in conflict with one another"
now thats right as i m converting date to string in filter and actual column is of datatype datetime, but i need to do so as filter accepts only strings. i also tried using # character instead of using quotes to enclose date in, (as in case of crystal reports) but it again gives same error.
can anyone help me plz ?