Page 1 of 1

Problems with MyQuery

Posted: Wed 18 Apr 2007 15:58
by EdderU2RSE
I'm finding a field in my table using MyQuery.
I Have a Database called Cars, with the next fields: Marca, Modelo, Color
My components are:
1 edit called txtmarca
1 Myquery
1 button
2 DBedit, to show modelo and color

My code in MyQuery is:
SELECT *FROM cars
WHERE marca=marca

My button:
MyQuery.close;
MyQuery.SQL.clear;
MyQuery.SQL.Text:='SELECT *FROM cars WHERE marca="'+txtmarca.text+'"';
MyQuery.Open;

I think that everything is ok, but I cant see the results in my DBedit.

Example:
When I write in marca='Ford'
I need to show Modelo=Lobo and color=Rojo
etc.......

P.S thanks :shock:

Posted: Thu 19 Apr 2007 11:00
by Antaeus
Please check that your DBEdit controls are set up properly (they are attached to MyQuery via TDataSource, and the DataField properties are set). Also check that your query returns not empty result set (MyQuery.RecordCount more than zero).