Help with SYntax

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
classicmydac
Posts: 38
Joined: Fri 23 Dec 2005 11:51

Help with SYntax

Post by classicmydac » Thu 12 Jan 2006 14:11

Upgraded from Paradox tables to MYSQL but the following statement does not bring any results back.

How do I resove this please.

Steve W




franchisee :=edit5.Text;
if franchisee = '199' then temp := 'SELECT * FROM Tickets WHERE DATEDIFF(:today,First_Letter_Date) > 30 AND Ticket_Status = "1st DVLA request" ORDER BY Registration_No DESC ';

if franchisee = '199' then temp := 'SELECT * FROM Tickets WHERE Ticket_Status = "Completed" AND Paid_date BETWEEN :startdate1 AND :enddate1 ORDER BY Location_Code';

if franchisee '199' then temp := 'SELECT * FROM Tickets WHERE Belongs_Number = "'+franchisee+'" AND Ticket_Status = "Completed" AND Paid_date BETWEEN :startdate1 AND :enddate1 ORDER BY Location_Code';
Query_Tickets.SQL.Text := temp;
Query_Tickets.ParamByName('startdate1').AsDatetime := DateTimePicker1.Date;
Query_Tickets.ParamByName('enddate1').AsDateTime := DateTimePicker2.Date;
Query_Tickets.Open;

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 13 Jan 2006 07:36

Please specify if there are any errors when you try to open Query_Tickets and check value of Active property after this. Set Query_Tickets.debug option to true just before your Query_Tickets is opened, and then run your application that opens Query_Tickets. Check your SQL statement and parameter values that will be shown in debug window and test it if necessary.

You typed three conditions. Be attentive: the first one and the second one are the same. Therefore your first query will never be executed!

Note: to use debug window don't forget to include MyDacVcl unit to uses list.

Post Reply