打开时如何刷新表格? [英] How to refresh form when I open?

查看:92
本文介绍了打开时如何刷新表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的窗体的TabPage中,我有一个CheckBox,如果选择了CheckBox,则该值将保存在Table字段中(在FormDataSource:ParametersTable中存在).

I have a CheckBox in my TabPage on my Form, if I select the checkBox, the value is saved in a Table field (present in my FormDataSource: ParametersTable).

我想在进入TabPage时刷新表单,就像按F5一样.

I want to refresh the form when I enter in TabPage, just Like pressing F5.

有可能吗?

推荐答案

有一篇很棒的文章,介绍了刷新表单数据的不同方法

There is a great article about different methods of refreshing the form's data here. Here are the basic outline:

此方法基本上使用该特定数据源记录的表单缓存中存储的内容刷新表单控件中显示的数据.调用refresh()方法将重新读取数据库中的记录.因此,如果在另一个进程中发生了记录更改,则在执行refresh()后将不会显示这些更改.

This method basically refreshes the data displayed in the form controls with whatever is stored in the form cache for that particular datasource record. Calling refresh() method will NOT reread the record from the database. So if changes happened to the record in another process, these will not be shown after executing refresh().

调用reread()将查询数据库并将当前记录的内容重新读取到数据源表单缓存中.在重新绘制网格内容之前(例如,当您离开该行导航或重新打开表单时),这不会在表单上显示更改. 如果您已通过代码添加或删除了记录,则不应使用它来刷新表单数据.

Calling reread() will query the database and re-read the current record contents into the datasource form cache. This will not display the changes on the form until a redraw of the grid contents happens (for example, when you navigate away from the row or re-open the form). You should not use it to refresh the form data if you have through code added or removed records.

调用research()将针对数据库重新运行现有的表单查询,因此将使用新的/已删除的记录来更新列表以及更新所有现有的行.这将尊重用户在表单上设置的所有现有过滤器和排序.

Calling research() will rerun the existing form query against the database, therefore updating the list with new/removed records as well as updating all existing rows. This will honor any existing filters and sorting on the form, that were set by the user.

调用executeQuery()还将重新运行查询并更新/添加/删除网格中的行.如果您在代码中修改了查询,并且需要刷新表单以根据更新后的查询显示数据,则应使用ExecuteQuery.

Calling executeQuery() will also rerun the query and update/add/delete the rows in the grid. ExecuteQuery should be used if you have modified the query in your code and need to refresh the form to display the data based on the updated query.

我强烈建议您阅读本文.尝试使用上述某些方法或它们的某些组合.

I strongly recommand that you read the article. Try to use some of the methods above or some combinations of them.

research()方法开始,它可能会解决您的问题:

Start with research() method, it might solve your problem:

formDataSource.research();

这篇关于打开时如何刷新表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆