[CLOSED] ZEOS Change query text at runtime lazarus / 16-Databases ---------------------------------------------------------------------- pcurtis · 2021-04-19 13:20 How can I change query text at run time of design time created objects. With run time created objects I do this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   MyQuery := TZQuery.Create(Self);   sSQL := ' SELECT ...';   MyQuery.SQL.Clear;  MyQuery.SQL.Add(sSQL);  but with the design time object it does not work. ---------------------------------------------------------------------- zeljko · 2021-04-19 13:43 sSQL := 'SELECT ....'; MyDesignSQL.Clear; MyDesignSQL.Add(sSQL); ---------------------------------------------------------------------- pcurtis · 2021-04-19 13:49 Read the question. It doesn't work. ---------------------------------------------------------------------- dseligo · 2021-04-19 14:07 What do you mean it doesn't work? Do you have an error? What does ShowMessage(MyDesignSQL.SQL.Text); show? ---------------------------------------------------------------------- pcurtis · 2021-04-19 14:13 Nothing, just empty. No errors, just the string is never changed. ---------------------------------------------------------------------- af0815 · 2021-04-19 14:22 Before you change the SQL, is your Query deaktivated ? MyQuery.active:= false; you cannot change the sql on a active query. ---------------------------------------------------------------------- miab3 · 2021-04-19 14:28 Hi, ZQuery1.Close; ZQuery1.SQL.Text:='...'; Michał ---------------------------------------------------------------------- pcurtis · 2021-04-19 14:32 No, it's closed. ---------------------------------------------------------------------- balazsszekely · 2021-04-19 14:37 @pcurtis Do you open the query after you change the sql? ---------------------------------------------------------------------- pcurtis · 2021-04-19 14:42 OK. Just reinstalled  ZEOS and all is OK. ---------------------------------------------------------------------- dseligo · 2021-04-19 16:13 Quote from: af0815 on April 19, 2021, 04:22:10 pmBefore you change the SQL, is your Query deaktivated ? MyQuery.active:= false; you cannot change the sql on a active query. In ZEOS you can. It's automatically closed when you change SQL.Text ---------------------------------------------------------------------- pcurtis · 2021-04-20 04:21 Thats what I thought, but now another problem occurs wiih parameters. ZQuery complains that it cant find a parameter even if it is in the query. (The same code works fine in runtime  created objects. ---------------------------------------------------------------------- balazsszekely · 2021-04-20 04:36 @pcurtis QuoteThats what I thought, but now another problem occurs wiih parameters. ZQuery complains that it cant find a parameter even if it is in the query. (The same code works fine in runtime  created objects.A small demo please, otherwise we just shot in the dark. ---------------------------------------------------------------------- pcurtis · 2021-04-20 10:43 It's a little more complicated. I'm working on a demo, but first I want to try Laz 2.0.10 ---------------------------------------------------------------------- pcurtis · 2021-04-21 19:34 It's beginning to look like a 2.0.12 issue or compatibly problem. It works as expected in 2.0.10 and is faster. Yep Laz 2.0.12 + ZEOS 7.2.8 sucks