Solved

TUpdateSQL question

Posted on 2002-07-18
8
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

710 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