Solved

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

Posted on 2010-09-21
7
832 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

13 Experts available now in Live!

Get 1:1 Help Now