Repair in Checkadas tables

Asked

Viewed 47 times

0

Follows the code:

status := DataModule1.ZQuery2.FieldByName('Msg_text').AsString;
  while not DataModule1.ZQuery1.Eof do
  begin
    if status <> 'OK' then
    begin
      DataModule1.ZQuery3.Close;
      DataModule1.ZQuery3.SQL.Clear;
      DataModule1.ZQuery3.SQL.Add('Repair tables ' + Parametro);
      DataModule1.ZQuery3.Open;
      ShowMessage(DataModule1.ZQuery3.Sql.Text);
    end
    else
    begin
    DataModule1.ZQuery1.Next;
    end;
  end;

With the help of Filipe.Fonseca, I was able to check the items, below the link.

Check the tables that appear on my first Dbgrid

I just want the Msg_Text, Don’t be OK, he performs the Repair. Someone could help me?

1 answer

0


Once again you are rolling with the Queries. Define names "friendly" not to give next in the wrong query, for example QryTabelas, QryStatus, etc..

Try it this way:

while not DataModule1.ZQuery2.Eof do
begin
  status := DataModule1.ZQuery2.FieldByName('Msg_text').AsString;
  if status <> 'OK' then
  begin
    DataModule1.ZQuery3.Close;
    DataModule1.ZQuery3.SQL.Clear;
    DataModule1.ZQuery3.SQL.Add('Repair tables ' + Parametro);
    DataModule1.ZQuery3.ExecSQL;
    ShowMessage(DataModule1.ZQuery3.Sql.Text);
  end
  DataModule1.ZQuery2.Next;
end;
  • Damn, man, it’s right again, I was performing the while with the Zquery1. and not with the 2. But ta show! It worked. As soon as I corrupt a database I’ll test it out and I’ll tell you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.