Board index » delphi » TDataset.Refresh doesn't work?

TDataset.Refresh doesn't work?

I'm using Delphi V4 (service pack 3).  I've found that TDataset.Refresh
doesn't work.  Here's a code example:

procedure RunQuery(qX: TQuery);
begin
   . . .
   if qX.State <> dsInactive then
      qX.Refresh;       {does nothing}
  . . .
end;

procedure RunQuery(qX: TQuery);
begin
   . . .
   if qX.State <> dsInactive then
   begin
      qX.Close;
      qX.Open;        {works as expected}
   end;
  . . .
end;

Teixeira & Pacheco claim that Refresh is the prefered approach.  Anyone else
having a problem with Refresh?

Rob Buck

 

Re:TDataset.Refresh doesn't work?


As has been said numerous times on this NG, Refresh doesn't work with DB
Servers like Oracle, SQLServer etc.  Supposedly it works on Paradox,
although I haven't used Refresh there either.  You'll need to Close and
Reopen a Query to refresh the data.

--
Michael Glatz
mgl...@caiso.com

Quote
Rob Buck wrote in message <7dh2ob$1...@forums.borland.com>...
>I'm using Delphi V4 (service pack 3).  I've found that TDataset.Refresh
>doesn't work.  Here's a code example:

>procedure RunQuery(qX: TQuery);
>begin
>   . . .
>   if qX.State <> dsInactive then
>      qX.Refresh;       {does nothing}
>  . . .
>end;

>procedure RunQuery(qX: TQuery);
>begin
>   . . .
>   if qX.State <> dsInactive then
>   begin
>      qX.Close;
>      qX.Open;        {works as expected}
>   end;
>  . . .
>end;

>Teixeira & Pacheco claim that Refresh is the prefered approach.  Anyone
else
>having a problem with Refresh?

>Rob Buck

Re:TDataset.Refresh doesn't work?


You are correct.  The refresh in most cases will not work for most client
server databases. Thus, you must close and reopen the dataset.

Thanks,
Earl Reddell
President
Res-cue (Resourceful Components for User Ease!)

http://www.res-cue.com

In article <7dh2ob$1...@forums.borland.com>,
  "Rob Buck" <buc...@norand.com> wrote:

Quote
> I'm using Delphi V4 (service pack 3).  I've found that TDataset.Refresh
> doesn't work.  Here's a code example:

> procedure RunQuery(qX: TQuery);
> begin
>    . . .
>    if qX.State <> dsInactive then
>       qX.Refresh;       {does nothing}
>   . . .
> end;

> procedure RunQuery(qX: TQuery);
> begin
>    . . .
>    if qX.State <> dsInactive then
>    begin
>       qX.Close;
>       qX.Open;        {works as expected}
>    end;
>   . . .
> end;

> Teixeira & Pacheco claim that Refresh is the prefered approach.  Anyone else
> having a problem with Refresh?

> Rob Buck

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Other Threads