Solved

Record number

Posted on 2000-03-10
4
243 Views
Last Modified: 2010-04-04
I use Delphi 3.o with Interbase.

I want to refresh a query in a dbgrid and stay at the currend record. You can't do this with:
Query1.refreh;

Instead I can close and open the query:

Query1.close;
query1.open;

But then my curor goes to the first record in the DBgrid. Is there a way to store the recordnumber and return to that later ?
0
Comment
Question by:RichardBorst
4 Comments
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
hi richard,

just remember a unique field(s) into a var and do a locate after the reopen.

meikl
0
 
LVL 12

Accepted Solution

by:
Faruk Onder Yerli earned 100 total points
Comment Utility
You can use TBookMark;

uses db;

var
  BookMark : TBookMark;
begin
  BookMark := Query1.GetBookmark;
  Query1.Close;
  Query1.Open;
  Query1.GotoBookmark(BookMark);
  Query1.FreeBookmark(BookMark);
end;

0
 
LVL 9

Expert Comment

by:ITugay
Comment Utility
dear richard,

I'm not sure about D3, but in D5 & IB5.6 you may do it like this:

var B : TBookmark;
......
  B:=Query1.GetBookmark;
  Query1.Close;
  Query1.Open;
  Query1.GoToBookmark(B);
.....

Cheers,
Igor.
0
 

Author Comment

by:RichardBorst
Comment Utility
Both kretzschmar and equalizer's will work. (Itried both).

I prefer the solution from equalizer's
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now