如何在更新数据库源后让Visual Studio 2010刷新我的DataSet? [英] How do I get Visual Studio 2010 to refresh my DataSet after I have updated the Database source?
问题描述
我已经添加了新的列到现在 MS Access 2010
数据库,我已经连接到 Visual Studio 2010
。更新数据库后,数据源窗口和 DataSet
没有新列。我查看了这样的答案: Visual Studio DataSet设计器刷新表,但是使用SELECT * FROM Reservations配置默认查询(其中建议更新查询将导致表刷新)没有刷新任何内容。并且数据源和数据库资源管理器窗口上的内置刷新按钮尚未捕获更新(还有一个新表,我想很快使用)。
I have added new columns to an existing MS Access 2010
Database that I have hooked into Visual Studio 2010
. After updating the Database, the Data Source window and DataSet
do not have the new columns. I looked at answers such as this: Visual Studio DataSet Designer Refresh Tables , but configuring the default query with "SELECT * FROM Reservations" (where it has been suggested that updating the query will cause the table to refresh) hasn't refreshed anything. And the built-in "Refresh" buttons on the Data Sources and Database Explorer windows haven't caught the updates yet (there is also a new table I would like to work with shortly).
我如何(非程序化地)更新我的DataSet?我有自定义绑定,不想通过删除这个数据源和重新添加手动重新创建它们。
How the heck do I (non-programatically) update my DataSet? I have custom bindings and do not want to have to manually re-create those by removing this data source and 're-adding' it. I would rather add some custom bindings for my new fields and keep on working away at this project!
推荐答案
Mine原来是这个项目的一部分。接近一个重复的问题...看到这里的答案(是的,它是简单的,通过在DataSet设计器下的TableAdapter配置)。
Mine turns out to be close to a duplicate question... See this for the answer (and yes, it is as simple as going through the TableAdapter configuration under the DataSet designer.)
在Visual Studio中更新DataSet结构以匹配新SQL数据库结构
另请参阅: http://msdn.microsoft.com/en-us/library/ms171902%28VS.80%29.aspx (如何编辑TableAdapters)
Also, see: http://msdn.microsoft.com/en-us/library/ms171902%28VS.80%29.aspx (How to edit TableAdapters)
...和,我几乎失去了我的想法,我实际上是一个子文件夹关闭(意味着在我的项目文件夹中有两个数据库副本)。项目 - > MyProject - > db.accdb和项目 - > MyProject - > MyProject - > db.accdb。如果你有这个问题,并且查询不工作,看看非常紧密的路径。非常关闭。 :)
... and, as I figured out after nearly losing my mind, I was actually one sub-folder off (meaning there were two copies of the database in my project folder). Projects -> MyProject -> db.accdb, and Projects -> MyProject -> MyProject -> db.accdb. If you're having this issue and querying is NOT working, look VERY closely at the path. VERY CLOSELY. :)
这篇关于如何在更新数据库源后让Visual Studio 2010刷新我的DataSet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!