Board index » delphi » Cann't refresh query

Cann't refresh query

I'm using a query with this SQL:
    SQL.Add ('SELECT * FROM TABLE_NAME');
    SQL.Add ('WHERE FIELD1 IN');
    SQL.Add ('(SELECT MAX(FIELD1) FROM TABLE_NAME GROUP BY FIELD2)');

I cann't refresh this query because of the condition.
QueryName.Refresh -> nothing doesn't happened, even not error.
I set TDBNavigator with a Refresh button - the button is visible, but it's
disabled.

Is it a bug?
Does anybody have solution for this problem?
Any help will be appreciated.

Rita Berioza.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet

 

Re:Cann't refresh query


Quote
elr...@netvision.net.il wrote:
>QueryName.Refresh -> nothing doesn't happened, even not error.

Use QueryName.Close, QueryName.Open instead. Does the same thing, and
it works.

Marc

======================================================================
[ Marc Scheuner, marc.scheu...@berner.ch  CH-3001 BERNE, Switzerland ]
======================================================================

Re:Cann't refresh query


Quote
elr...@netvision.net.il wrote:

> I'm using a query with this SQL:
>     SQL.Add ('SELECT * FROM TABLE_NAME');
>     SQL.Add ('WHERE FIELD1 IN');
>     SQL.Add ('(SELECT MAX(FIELD1) FROM TABLE_NAME GROUP BY FIELD2)');

> I cann't refresh this query because of the condition.
> QueryName.Refresh -> nothing doesn't happened, even not error.
> I set TDBNavigator with a Refresh button - the button is visible, but it's
> disabled.

> Is it a bug?
> Does anybody have solution for this problem?
> Any help will be appreciated.

> Rita Berioza.

> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

Use Sql.ExecSql

Cheers
Conrad Smith

Re:Cann't refresh query


Check Delphi Help: Don't use refresh for queries, use open instead!

Quote
elr...@netvision.net.il wrote:
> I'm using a query with this SQL:
>     SQL.Add ('SELECT * FROM TABLE_NAME');
>     SQL.Add ('WHERE FIELD1 IN');
>     SQL.Add ('(SELECT MAX(FIELD1) FROM TABLE_NAME GROUP BY FIELD2)');

> I cann't refresh this query because of the condition.
> QueryName.Refresh -> nothing doesn't happened, even not error.
> I set TDBNavigator with a Refresh button - the button is visible, but it's
> disabled.

> Is it a bug?
> Does anybody have solution for this problem?
> Any help will be appreciated.

> Rita Berioza.

> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

Re:Cann't refresh query


Quote
Conrad Smith wrote:
> elr...@netvision.net.il wrote:

> > I'm using a query with this SQL:
> >     SQL.Add ('SELECT * FROM TABLE_NAME');
> >     SQL.Add ('WHERE FIELD1 IN');
> >     SQL.Add ('(SELECT MAX(FIELD1) FROM TABLE_NAME GROUP BY FIELD2)');

> > I cann't refresh this query because of the condition.
> > QueryName.Refresh -> nothing doesn't happened, even not error.
> > I set TDBNavigator with a Refresh button - the button is visible, but it's
> > disabled.

> > Is it a bug?
> > Does anybody have solution for this problem?
> > Any help will be appreciated.

> > Rita Berioza.

> > -------------------==== Posted via Deja News ====-----------------------
> >       http://www.dejanews.com/     Search, Read, Post to Usenet

> Use Sql.ExecSql

> Cheers
> Conrad Smith

  There is nor Refresh Method for TQuery;
  Just Close then Open;
  this will put you in the first record of your Query.
  if you want to go back to the current record,
  save the primary key(s) of your query to variable(s) then
  Use Query.Locate() !!!

bye
Zandy

Other Threads