DatagridView数据绑定无法添加新列

发布于 2024-12-08 14:54:51 字数 341 浏览 0 评论 0原文

请帮忙! 我不知道我做了什么!!! 我有一个 datagriveview 数据绑定 .Net 4 C# windows 窗体应用程序。在某些时候,我在代码中将连接字符串更改为 1,因为我不希望在配置文件中看到它。现在,当我尝试从数据库中选取一个新列并将其添加到网格视图时,我收到错误消息,提示找不到连接字符串。

我已将其重新添加到属性设置中,但仍然出现相同的错误!

如何从 datagridveiw 追溯到它从哪里获取它,以便我可以手动添加列。

它使用 dataset.xsd,我在其中看到错误重新连接字符串。

总之,我有一个 datagridview,我正在尝试手动更新它以获取数据库中的新列。

Help Please!
I don't know what I have done!!!
I have a datagriveview data bound .Net 4 C# windows forms app. At some point I changed the Connection string to one in code as I didn't want it seen in a config file. now when I try to pick up a new column from the database and add it to the grid View I get and error saying it can't find the connectionString.

I have re added it to the Properties settings but still get the same error!

How do I trace back from the datagridveiw to find where its picking it up from so I can add a column manually.

It uses a dataset.xsd which where I see the error re connection string.

So in summary I have a datagridview that I'm trying to update manually to pickup a new column in the database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

活泼老夫 2024-12-15 14:54:51

转到您的数据集并找到您用于填充数据的表适配器。单击适配器中标有“SomethingTableAdapter”的部分(下面 SS 中的橙色部分)。当您单击“连接属性”时,是否允许您选择在“设置”中找到的连接字符串?如果没有选择它。

在此处输入图像描述

如果这不起作用,我会编辑我的答案来帮助您,但我会假设当您第一次删除连接字符串时,表适配器本身也丢失了对它的引用。

Go to your dataset and find the tableadapter that you are using to populate your data with. Click on the part of the adapter that says "SomethingTableAdapter" (in orange in the SS below). When you click the "connection property" does it allow you to select the connection string you have located in your Settings? If not select it.

enter image description here

I'll edit my answer to help you if that doesn't do the trick, but I'd assume that when you deleted the connection string the first time, the tableadapter itself lost the reference to it as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文