Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TUpdateSQL question

Posted on 2002-07-18
8
Medium Priority
?
211 Views
Last Modified: 2010-07-27
I'm developing a multi-user application with Paradox database tables. All systems do have their setting LocalShare = true (BDE).

In the window "customer maintenance" I am using a TQuery to display all records in a TDBGrid component. Furthermore, I am trying to use a TSQLUpdate component to maintain the data. At the moment that I click on Post (of the TDBNavigator) the following procedure will be executed:

TFormCustMaint.Query1AfterPost(DataSet: TDataSet);
begin
  Query1.ApplyUpdates;
  Query1.Active := false;
  Query1.Active := true;
end;

The new record will be inserted but the focus (within the TDBGrid component) will change to the first record of the table. I have tried to use TBookmark but this will not work (I think because of some AutoInc fields within the table?).

Question: how can I make sure that the focus will stay on the same record after the Query1AfterPost event has been launched?
Note: maybe I am "mis-using" the TSQLUpdate component? Sorry for that... I am still that beginner... :-)

Thank you in advance.
RoosieDB
0
Comment
Question by:roosiedb
8 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7163251
hi,

Store/remember your keyfields
(fields which can identify the record unique),
which are not autoinc-values
and then do a locate after open

if you don't have such other keyfields,
then i guess you have to redesign
by avoiding autoinc-values

(maybe a method to supply this fields
with a number before posting)

meikl ;-)
0
 

Author Comment

by:roosiedb
ID: 7164160
How can I store/remember the keyfields?
I have tried to use TBookmark but this won't work (I think because the AutoInc-field doesn't have a value at that moment yet?)...

And my only goal is to have a screen in which I can maintain a list of articles, by using a TSQLUpdate component. As soon as a new record has been inserted, I want to apply these changes and see my DBGrid displaying the records in the right order again (with the cursor on the record which just has been inserted).

thx.
RoosieDB
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7164175
>How can I store/remember the keyfields?

TFormCustMaint.Query1AfterPost(DataSet: TDataSet);
var
  f1,f2,f3 : String; //by other types, other vars
begin
 f1 := Query1.FieldByName('Field1').AsString; //by other types, other conversion
 f2 := Query1.FieldByName('Field2').AsString;
 f3 := Query1.FieldByName('Field3').AsString;
 Query1.ApplyUpdates;
 Query1.Active := false;
 Query1.Active := true;
 Query1.Locate('Field1;Field2;Field3',VarArrayOf([f1,f2,f3]),[]);
end;

just from head

meikl ;-)


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:roosiedb
ID: 7164250
OK, this make sense.......
I will try this tonight, when I'm back in the "private office" :-)
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 7168949
any results?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7179522
just asking again:
any results?
0
 

Expert Comment

by:CleanupPing
ID: 9343036
roosiedb:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 9461268
roosiedb,
No comment has been added lately (18 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to kretzschmar http:#7163251

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

anAKiN
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

971 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