When you run 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 ('Opened') + 'or Status =' + QuotedStr ('In Progress') + ')' +
'and (Account =' + QuotedStr (user) + ')';
DM.ADOQuery9.Active: = true;
DM.ADOQuery9.RecNo: = a;
end;
end.
pops up an error:
ADOQuery9. cannot perform this operation on a closed dataset
I still haven’t found a place in the code where I should open the dataset for editing, or am I digging in the wrong place?
Answer 1
Try it
form1.ADOQuery1.Close;
form1.ADOQuery1.SQL.Clear;
form1.ADOQuery1.SQL.Add ('Select * from Application where (Status =' +
QuotedStr ('Opened') + 'or Status =' + QuotedStr ('In Progress') + ')' +
'and (Account =' + QuotedStr (user) + ');
form1.ADOQuery1.Open;
form1.ClientDataSet1.Refresh;