添加列多到一个数据库表时,你如何让你的datagridview显示的变化? [英] when adding a column more to a DB table, how do you get your datagridview to show the change?

查看:181
本文介绍了添加列多到一个数据库表时,你如何让你的datagridview显示的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio中的一个项目,它指向一个表在我的数据库中创建一个数据集 然后绑定一个DataGridView控制它。

I have created a dataset in a project in visual studio that points to a table in my database and then bound a datagridview control to it.

现在我打开数据库,另一列添加到数据库中的表。 然后我打开数据库和更新它的配置包括更改。

Now I open the database and add another column to the table in the database. Then i open the dataset and update it's configuration to include the change.

然后我想更新datagridview的,但我不能添加新列。 我可以用鼠标右键点击的TableAdapter在DataGridView中的格式,并得到正确的表中的数据了。

Then i want to update the datagridview, but I can't add the new column. I can right click on the tableadapter in the form where the datagridview is and get the correct table data up.

这并不重要,如果我删除形式的TableAdapter和的BindingSource和数据集中实例的关系,然后尝试重新绑定,在DataGridView仍然不会让我添加新列。

It does not matter if I delete the tableadapter and the bindingsource and dataset instance from the form, and then try and rebind it, the datagridview still won't let me add the new column.

没有任何人有一个想法发生了什么事?
我已经试过这几个项目,无论是VS2008和2010测试版,而不是与其他语言比C#寿。
唯一的解决办法,到目前为止似乎是做一个完全不同的数据集,但必须有一个更好的办法。

Does anyone have an idea what is happening?
I've tried this with several projects, both VS2008 and 2010 beta, not with other languages than C# tho.
The only solution so far seems to be to make a whole different dataset, but there has to be a better way.

在此先感谢

推荐答案


中的文件夹 C:\ Users \用户YOURUSERNAME \应用程序数据\本地\微软\的VisualStudio \ 9.0 \ ProjectAssemblies
Visual Studio中有编制的东西,它使用的快速参考的负载。这些都是经过一番散列方案命名的,所以我们无法分辨哪一个是我们的拙劣表计划的编制设置。
1.我们首先关闭Visual Studio的(我只是做了它是在安全方面)
2.删除ProjectAssemblies文件夹中的所有文件夹。 3.打开Visual Studio中再次
4.重新生成解决方案
5.现在我们得到正确的价值观,当我们将列添加到我们的datagridview。

Under the folder in
"C:\Users\YOURUSERNAME\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies"
visual studio has a load of compiled things it uses for quick reference. These are named after some hashing scheme so we can't tell which one is the compiled settings for our botched table scheme.
1. We start by closing Visual Studio (I just did it to be on the safe side)
2. Delete all the folders in the ProjectAssemblies folder.
3. Open up Visual Studio again
4. Rebuild solution
5. And NOW we get the correct values when we add columns to our datagridview.

呼! :D

这篇关于添加列多到一个数据库表时,你如何让你的datagridview显示的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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