[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Seeing database changes in a DBGrid

Posted on 2004-11-04
5
Medium Priority
?
321 Views
Last Modified: 2010-04-05

I'm using the ADO components to access an Access database.

I've a TDBGrid pointing to a TDataSource pointing to a TADOTable, giving me a list of what's in that table.

I make a change using a query somewhere else.

How do I get the table to reflect the changes? (In this case an added record, but I'll probably want to delete and modify stuff shortly..)



(Actually using C++Builder, but the database Gurus tend to hang out in this TA!)
0
Comment
Question by:andrewjb
5 Comments
 
LVL 12

Accepted Solution

by:
esoftbg earned 1000 total points
ID: 12492910
TADOTable.Requery
0
 
LVL 26

Expert Comment

by:Tomas Helgi Johannsson
ID: 12492926

use    
 ADOTable.Refresh;

after executing the insert/update/delete query

Regards,
  Tomas Helgi
0
 
LVL 12

Author Comment

by:andrewjb
ID: 12493015
I'd tried refresh - it doesn't work for some reason.

Requery is great. Anyone know why?
0
 
LVL 6

Expert Comment

by:Amir Azhdari
ID: 12493087
from delphi help :

REQUERY :
Call Requery to refresh the recordset. Requery updates the dataset by re-executing the original command or SQL statement that produced the recordset.

The effects of Requery are the same as calling the dataset’s Close method and then its Open method. However, there are circumstances when one means of refreshing the recordset is better than the other. The values in properties like CursorLocation, CursorType, and LockType cannot be changed while the dataset is open, so Requery can only refresh the recordset using the existing values in these properties. To refresh the recordset using different values for these properties, effect the refresh using the Close and Open methods.

Options is a TExecuteOptions value that specifies the characteristics of the command execution affected by the requery that produces the recordset for the dataset.


REFRESH :
The Refresh method does not work for all TDataSet descendants. In particular, TQuery components do not support the Refresh method if the query is not “live”. To refresh a static TQuery, close and reopen the dataset.



by the way , don't accept this comment as answer please
Regards
Amir
0
 
LVL 12

Author Comment

by:andrewjb
ID: 12493121
Yup - read that. It's a table, though, not a query. Perhaps just one of Delphi's quirks..

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
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. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

834 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