List Info

Thread: problem in select command




problem in select command
country flaguser name
United States
2007-08-17 09:01:03

Changing
item:=AdoQuery1. ExecSQL;
to AdoQuery1. Open;
Doesn't solve the problem,the same error appear

---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel.

[Non-text portions of this message have been removed]

__._,_.___
SPONSORED LINKS
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

New business?

Get new customers.

List your web site

in Yahoo! Search.

Yoga Groups

Exchange insights

with members of

the yoga community.

Re: problem in select command
country flaguser name
United States
2007-08-20 04:53:49

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 delphi-en%40yahoogroups.com">delphi-enyahoogroups.com, sara-arian <aban4009...> wrote:
&gt;
> Changing
> item:=AdoQuery1. ExecSQL;
> to AdoQuery1. Open;
&gt; Doesn't solve the problem,the same error appear
&gt;
>
>

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )