I connect TFDQuery with TStringGrid in live binding in delphi firemonkey apps.
I tried to use filter in TFDQuery based on Editbox for searching purpose, and it's work just fine.
but, whenever I clear the Editbox, one of my row in TStringGrid would show "(bcd)" as it's value like the pict below.
what am I doing wrong ? how can I fix it ?
Edit :
- Im using mySql database with firedac tfdconnection + tfdquery
- the datatype of the column is AnsiString & FmtBCS(32,0)
- Im using live binding feature in delphi.
my filter code
with MainQuery do begin Filtered := False; OnFilterRecord := nil; Filter := FilterValue; Filtered := True; end;
I Insert to the table with TFDConnection.execSQL
the "(BCD)" part always change on the selected Row as the pict below.
EDIT 2: To Reproduce my error, you can :
- add TStringGrid.
- Add Editbox.
- add tfdconnection
- add tfdquery
- use live binding from tfdquery to tstringgrid.
- add query to tfdquery.sql.text that using SUM() in mysql. Example :
"select id, sum(stock) as total_stock from stocks"
- activate that tfdquery
- add onkeyup event on editbox.
- add this code :
FilterValue:= 'garmines_id LIKE ''/' +Edit1.Text+'%'' ESCAPE ''/'' ';
with FDQuery1 do begin
Filtered:= false;
OnFilterRecord := nil;
Filter := FilterValue;
Filtered := True;
end;
- run
- try to type something on editbox to make sure filter works fine.
- clear editbox, then the "(BCD)" is show on the selected row.
InsertRecord
statements which insert the data shown into the db table. – MartynA