When executing the following code:

procedure TForm4.Timer1Timer(Sender: TObject); var a: Integer; begin a := DM.ADOQuery9.RecNo; user := LoggedOnUserNameEx(3); DM.ADOQuery9.Active := False; DM.ADOQuery9.SQL.Clear; DM.ADOQuery9.SQL.Text := 'Select * from Application where (Status=' + QuotedStr('Открыта') + ' or Status=' + QuotedStr('В процессе') + ')' + ' and (Account=' + QuotedStr(user) + ')'; DM.ADOQuery9.Active := true; DM.ADOQuery9.RecNo := a; end; end. 

error pops up:

ADOQuery9. dataset cannot perform this operation

I didn’t find a place in the code where I should open a dataset for editing, or am I not digging there at all?

  • On which line does the error occur? - Anton Shchyrov
  • Does not show on which line - e.khamidullin
  • one
    Before starting the timer ADOQuery9 opens? - Anton Shchyrov
  • one
    Found a mistake, thank you all. Closed question - e.khamidullin
  • 6
    Your question is useless to the community. Either publish the answer, or delete it - Anton Shchyrov

1 answer 1

Try

  form1.ADOQuery1.Close; form1.ADOQuery1.SQL.Clear; form1.ADOQuery1.SQL.Add('Select * from Application where (Status=' + QuotedStr('Открыта') + ' or Status=' + QuotedStr('В процессе') + ')' + ' and (Account=' + QuotedStr(user) + '); form1.ADOQuery1.Open; form1.ClientDataSet1.Refresh; 
  • ADOQuery1.Text = '' Makes Close and overwrites existing data, so it replaces Clear and Add . QuotedStr... - Potentially dangerous places, parameters must be used. - androschuk