在Visual Studio中更新DataSet结构以匹配新的SQL数据库结构 [英] Update DataSet structure in Visual Studio to match new SQL Database Structure

查看:148
本文介绍了在Visual Studio中更新DataSet结构以匹配新的SQL数据库结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对SQL数据库结构进行了一些更改(在SQL Server Management Studio中使用脚本),如何在Visual Studio中更新DataSet.xsd文件以匹配新结构?我必须手动执行?

我考虑删除DataSet并导入一个新的,但我会丢失所有我的自定义表适配器查询。

After making some changes to my SQL database structure (using scripts in SQL Server Management Studio), how can I update my DataSet.xsd file in Visual Studio to match the new structure? Must I do this manually?
I considered deleting the DataSet and importing a new one, but I'll lose all my custom Table Adapter queries.

推荐答案

可能您的问题已被回答这里http://social.msdn.microsoft.com/Forums

Probably your problem has been answered here at http://social.msdn.microsoft.com/Forums

编辑: / strong>我刚才意识到这是一个非常糟糕的答案。那么那时候,我是一个真正的初学者在这个网站。所以我更新我的答案,现在在这里复制上面链接的相关内容

I realize just now that this was/is a very poor answer. Well, at that time, I was a real beginner in this site. So I update my answer now copying here the relevant content of the link above


如果右键单击数据集设计器中的TableAdapter,然后单击
'配置'打开TableAdapter配置向导,您可以在其中
重新配置定义表的模式的主查询。这个
应该留下在初始配置后添加的额外的TableAdapter查询(额外的
方法)。

If you right-click the TableAdapter in the Dataset Designer and click 'Configure' the TableAdapter Configuration Wizard opens where you can reconfigure the main query that defines the schema of your table. This should leave the additional TableAdapter queries (the additional methods) that were added after initial configuration.

当然,附加的方法也需要如果它们引用已从
数据库中的表中删除的列,或者任何列定义更改(例如,如果
更改或修改数据类型),则重新配置。因此,如果一个有用的列是
添加到表中,并且它允许Null值,现有的方法
仍然可以正常工作 - 只是取决于数据库中表的
的变化范围

Of course the additional methods will also need to be reconfigured if they reference a column that has been removed from the table on the database, or if any of the column definitions change (for example, if the data type is changed or modified). So if an aditional column was added to the table and it allows Null values the existing methods should still work - just depends on the scope of change to the schema of the table in the database.

我也想在这里报告aswerer的名字,但没有。

I wish to report here also the name of the aswerer, but there is none.

这篇关于在Visual Studio中更新DataSet结构以匹配新的SQL数据库结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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