Reputation: 11
Well guys, I have a little problem in this part of filtering the table fields, for example doing a name search for such tableX.
Only I'm getting this error:
Project raised exception class EDatabaseError with message 'sql: Field ' not found'.
Next:
I used a ListName method, it was going to do a search for the name of my Table clients in the DBGrid case.
procedure TfrmConsult.ListarClients;
var
Text: String;
begin
Text := 'SELECT * from clients WHERE id > 0';
if edtName.Text <> '' then
Text := Text + ' AND name LIKE ' + Quotedstr(edtName.Text + '%');
Text := Text + ' ORDER BY name';
sqlClients.SQL.Text := Texto;
sqlClients.Open;
end;
I linked more than one table to search other fields within a table in TZQuery's SQL, so I put it like this:
SELECT c. *, cit.city, cit.uf
FROM customers c
INNER JOIN city cit
ON cit.id = c.id
// Since there are 2 tables linked in SQL, it doesn't know why the field was not found in the Table.
I ended up finding an error, I just don't know how to solve it, that I'm still new to Delphi, and speaking English is bad, but I hope you understand .... more if you can give me a strength there to understand and resolve, most importantly, I didn't give up.
I use Delphi XE2, TZQuery and Zeos
Upvotes: 1
Views: 2350
Reputation: 12292
In your request:
SELECT c. *, cit.city, cit.uf FROM....
try removing the space between c. and * like this
SELECT c.*, cit.city, cit.uf FROM....
Upvotes: 1