Solved

Record number

Posted on 2000-03-10
4
245 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
ID: 2603667
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
ID: 2603697
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
ID: 2603708
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
ID: 2618994
Both kretzschmar and equalizer's will work. (Itried both).

I prefer the solution from equalizer's
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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