Cannot perform this operation on a closed dataset

11,604

Your code looks fine.

Check if there are any event handlers (OnBeforeOpen) or master/detail datasources attached to the query. In this case a different dataset, which is still closed, could cause the error.

Share:
11,604
Vishal Tiwari
Author by

Vishal Tiwari

Updated on June 04, 2022

Comments

  • Vishal Tiwari
    Vishal Tiwari almost 2 years

    I am just trying to execute the "select" sql statement using TADOQuery component, but when TADOQuery's "Open" statement is executing I am getting following error:

    Cannot perform this operation on a closed dataset... 
    
    ADOQuery1.Active := False;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('Select * from Table1 where Column1 = <value>');
    ADOQuery1.Open;
    

    Any guess why I am getting this error ?