First, any derived StringGrid ("Grids/StringGrid/etc...") in Firemonkey is not data aware like the DBGrid in VCL is!
So, forget about this relationship here at Firemonkey!
FMX uses the LiveBinding framework to make the bridge between the StringGrid/Grid and the data source (table/query/etc...), and the component/class used is the "BindSourceDB" (same function as the Datasource in VCL) ;
you don't need to keep opening and closing the database connection! Unless you need it for some reasonable reason, eg low bandwidth connection etc...
you can:
before or when o form is open: FDConn.Open;
after or when o form is closed: FDConn.Close; // this close all datasets using this connection component!
you close the "query" only when:
dont needs anymore use it
needs changes the SQL text
needs changes some params (if dont using PARAMetrization correctly)
when using: "Select" you should use "qry.OPEN" // return a data-set
when using: "Insert, Delete, Update" you should use "qry.EXECUTE" // execute dont return any data-set!
said this, then you can try:
procedure TForm1.Button1Click(Sender: TObject);
begin
FDQuery.Close; // to execute a new statement, or end session! for example
//
// you can use this way to new statment, be OPEN or EXECUTE!
//FDQuery.SQL.Text := '.... new statement ....';
//
FDQuery.ExecSQL('your Insert,Delete, Update expression'); // to execute your command
//
// to open your query with data refreshed
FDQuery.Open('your Select... expression'); // to show your data-set result
//
FDQuery.Close; // to close your query."OPENED"
end;
I think that your "error" should be because your "statement" is wrong!!!!
try see what is the SQL text after "qry.SQL.Assign(m1.Lines);"
ShowMessage( qry.SQL.Text );