更新数据库源后,如何让 Visual Studio 2010 刷新我的数据集?

How do I get Visual Studio 2010 to refresh my DataSet after I have updated the Database source?(更新数据库源后,如何让 Visual Studio 2010 刷新我的数据集?)

本文介绍了更新数据库源后,如何让 Visual Studio 2010 刷新我的数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将新列添加到现有的 MS Access 2010 数据库中,该数据库已连接到 Visual Studio 2010.更新数据库后,数据源窗口和 DataSet 没有新列.我看了这样的答案: Visual Studio DataSet Designer Refresh Tables ,但是使用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).

我到底如何(非编程方式)更新我的数据集?我有自定义绑定,不想通过删除此数据源并重新添加"它来手动重新创建它们.我宁愿为我的新字段添加一些自定义绑定,并继续在这个项目上工作!

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!

推荐答案

我的问题接近于重复的问题......请参阅这个以获得答案(是的,就像通过 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 以匹配新的 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 刷新我的数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:更新数据库源后,如何让 Visual Studio 2010 刷新我的数据集?

基础教程推荐