If you are receiving error: "Commands out of sync; you can't run this command now" in dbExpress / MySQL connection, then check your query, probably it's something wrong...
Also, with connection to MySQL you can't do "select" SQL statement inside transaction, for example:
var DBXTran: TDBXTransaction; begin sql1.Close; sql1.SQL.Clear; sql1.SQL.Text := 'select * from table_one'; sql1.Open; cds2.Open; try DBXTran := connnection1.BeginTransaction; cds2.Append; cds2.FieldByName('MyField').AsString := 'test'; cds2.Post; cds2.ApplyUpdates(0); connnection1.CommitFreeAndNil(DBXTran); finally connnection1.RollbackIncompleteFreeAndNil(DBXTran); end;
Will be ok, while:
var DBXTran: TDBXTransaction; begin cds2.Open; try DBXTran := connnection1.BeginTransaction; sql1.Close; sql1.SQL.Clear; sql1.SQL.Text := 'select * from table_one'; sql1.Open; cds2.Append; cds2.FieldByName('MyField').AsString := 'test'; cds2.Post; cds2.ApplyUpdates(0); connnection1.CommitFreeAndNil(DBXTran); finally connnection1.RollbackIncompleteFreeAndNil(DBXTran); end;
Will give you the error...