I have the following query to one of my database tables:
select count(*) as mycount from mytable where fieldone = :fieldone and fieldtwo = :fieldtwo
Parameters are correctly loaded into the query (both of type String).
When I run this query outside the app (for instance, through the dbexplore) and replace the parameters with the actual values, I get the correct result. But when running it in the app, I get a
Field 'fieldtwo' not found error, right on the Query.Open call.
Why would the BDE not find this field, when it actually exist?
Update: The following query, executed right after the first one (the one that fails), works fine in the app:
select * from mytable where fieldone = :fieldone order by fieldone, fieldtwo
Clear the query content using
Query1.SQL.Clear; statement before opening it.
Other reason can be you are opening other database which may not have the specified field. Be sure that both the
DatabaseName's in your app and dbexplore are same