Solved

How do I get ADOTable1.Post to immediatley update the database in delphi?

Posted on 2010-09-21
7
850 Views
Last Modified: 2013-11-23
I update data in a access (2003) database. I immediatley want to access the database and at the moment, I have to put a Sleep command in. I have seen comments on ApplyUpdates for other databases but Access doesn't have one. Is there something else I can use?
0
Comment
Question by:Neil_Jessop
[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
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:briangochnauer
ID: 33727925
ApplyUpdates  is part of the component TClientDataset;
What component are you using to access Access?  
dbExpress
TSQLQuery
TSQLTable
 ADO  
TADOTable
TADOQuery
BDE
TTable
TQuery
 
0
 

Author Comment

by:Neil_Jessop
ID: 33727995
I am using TADOTable to update the data, and TADOQuery to subsequently read it.
0
 
LVL 5

Expert Comment

by:briangochnauer
ID: 33728076
Huh? That can't work really.
The answer to your original question is use Post method like;
MyTable1.Post;
commits the data to the database; but I think you have other issues;
since you can update ADOTable without first reading it;
And if your querying with ADOQuery why not update it?
0
Technology Partners: 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:Neil_Jessop
ID: 33728194
I use a ADOTable.Post to commit the data to the database on one form.

On another form I try to read data, automatically, using a ADOQuery. The trouble is that when reading the data in the ADOQuery, it seems that the ADOTable.Post event hasn't written it to the database. If I put a Sleep(5000) between the ADOTable.Post and the read in using the ADOQuery, it works. But I have the problem that Sleep(5000) works on my machine but I have to use longer on other machines. I wondered if there was any other way?

0
 
LVL 5

Accepted Solution

by:
briangochnauer earned 250 total points
ID: 33728321
It's really a design problem not a Delphi problem.
Are these separate applications you're calling 'Forms"?

If not, put the ADO data objects in a DataModule; so they can share an ADOConnection
Or put the ADOConnection on a common unit.
Or you could use a ClientDataset object and local data provider in a DataModule
0
 
LVL 5

Expert Comment

by:briangochnauer
ID: 33728433
How do I get ADOTable1.Post to immediatley update the database in delphi?
Close it,  
ADOTable.Close;
0
 

Author Closing Comment

by:Neil_Jessop
ID: 33729579
Sort of answered but there is a better way.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…

752 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