Strange #42SS Error
Posted: Thu 03 Apr 2008 15:33
Hi
I'm using a MySQL 5.0 with BDS2006 and MyDAC 5.20.1.14
I have a TQuery with the following SQL
SELECT
a.*
FROM
account a
WHERE
a.Acc_Type = :Acc_Type AND
IF(:Active '', a.Active = :Active, TRUE) AND
IF(:Acc_Code '', a.Acc_Code LIKE CONCAT_WS('', '%', :Acc_Code, '%'), TRUE) AND
IF(:Acc_Name '', a.Acc_Name LIKE CONCAT_WS('', '%', :Acc_Name, '%'), TRUE)
ORDER BY
a.Acc_Code
I have created many Queries in the past without any trouble using MyISAM tables. I have just started a new project using InnoDB so that I can use Foreign Keys and Transactions.
When I open the form I have a routine that supplies the relevant variables and executes the query. All normal stuff. However, after 60 secs I get the following error message (twice, the first from EMySQLException the second from EMyError)
#42S22Unknown column 'a.Acc_Type' in 'where clause'
The error doesn't affect the workings of the form. I can create, edit and delete records from the table as normal.
It only happens once for the form.
Why? How do I fix it?
I'm using a MySQL 5.0 with BDS2006 and MyDAC 5.20.1.14
I have a TQuery with the following SQL
SELECT
a.*
FROM
account a
WHERE
a.Acc_Type = :Acc_Type AND
IF(:Active '', a.Active = :Active, TRUE) AND
IF(:Acc_Code '', a.Acc_Code LIKE CONCAT_WS('', '%', :Acc_Code, '%'), TRUE) AND
IF(:Acc_Name '', a.Acc_Name LIKE CONCAT_WS('', '%', :Acc_Name, '%'), TRUE)
ORDER BY
a.Acc_Code
I have created many Queries in the past without any trouble using MyISAM tables. I have just started a new project using InnoDB so that I can use Foreign Keys and Transactions.
When I open the form I have a routine that supplies the relevant variables and executes the query. All normal stuff. However, after 60 secs I get the following error message (twice, the first from EMySQLException the second from EMyError)
#42S22Unknown column 'a.Acc_Type' in 'where clause'
The error doesn't affect the workings of the form. I can create, edit and delete records from the table as normal.
It only happens once for the form.
Why? How do I fix it?