i try to find the number of field in a Mysql table. the table has 10 fields.
using
Code: Select all
tblDetail.FieldCount;
i have try to use a TZQuery in a function returning an integer
Code: Select all
Query.SQL.ADD('SELECT COUNT(*) as total FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "' + mytable +'" AND TABLE_SCHEMA = "' + myDatabase + '";';
Query.ExecSQL;
Result := Query.FieldByName('total').asInteger;
Sending the query with the same user end password to the mysql utility return the good field count (10)Query: Field not found "total"
i use Lazarus 0.9.30 with FPC 2.4.2 on windows 7 and mysql 5.5
an idee
Thanks
Claude