Hi,

> day := 'SELECT * FROM checks ';
> AdoQuery1.Close;
> AdoQuery1.SQL.Clear;
> AdoQuery1.SQL.Add(day);
> ADOQuery1.Active:=true;
> item := AdoQuery1.ExecSQL;
> AdoQuery1.close;


Remove this line:
> ADOQuery1.Active:=true;

It does the same thing as calling Open.

Change this line:
> item := AdoQuery1.ExecSQL;

To:
AdoQuery1.Open;

As previously recommended. You must use Open when you expect records 
to be returned (i.e. when doing a select query) and ExecSQL when 
records will not be returned (i.e. insert, update, delete queries).

You will then need to work with the data before closing the query.
e.g. item := AdoQuery1.FieldByName('item').AsInteger;

I've not seen the error 'Variant does not reference an automation 
object' before and can't find details of it on MSDN or elsewhere so 
if the above doesn't help I'd try some basic stuff. Does your query 
component have a TADOConnection? Is the connection object active? Can 
you use a TADOTable with the same connection object to open the 
checks table? Place a breakpoint at the start of your code and step 
through it, on which line do you get the error?

Hope this helps,
Dave.

Dave Murray
Glasgow, UK


--- In [email protected], sara-arian <[EMAIL PROTECTED]> wrote:
>
> Changing 
>    item:=AdoQuery1. ExecSQL;
> to AdoQuery1. Open;
>   Doesn't solve the problem,the same error appear
> 
> 
>        


Reply via email to