VB.NET:从存储过程获取 DataGridView 进行填充

发布于 2024-07-14 12:46:40 字数 522 浏览 8 评论 0原文

我刚刚接到一份 VB.NET 原型设计工作,而且我对 VB.NET 的经验不是很丰富。

我必须创建一个存储过程,它按顺序返回一个自引用表。 有一次,我完成了我想要获得一个 DataGridView 来显示结果。

以前,我的团队已经通过 VB.NET 的 GUI 设计器完成了很多这样的工作,因此不幸的是,我没有大量代码可以描述。

我试图遵循他们的模式,我将在这里简要描述:

我有一个 DataGridView,其 DataSource 属性指向 BindingSource。 BindingSource 指向一个DataSet。 该数据集的编辑器调用一个 TableAdapter,它从存储过程中获取数据。

我预览了 TableAdapter 的数据。 数据就在那里。 在 frmMain 加载时,运行 TableAdapter 的 Fill 命令。

什么也没看到。 我的直觉是,这个过程太复杂了,不可能是正确的。 或者可能不是。 在我决定打扰你们这些好人之前,我做了很多谷歌搜索。

I was just handed a VB.NET prototyping effort, and I'm not very experienced with VB.NET.

I had to create a stored procedure which returns a self-referential table in order. Once, I completed that I wanted to get a DataGridView to show the results.

Previously, my team has been doing a lot of this via the GUI designer of VB.NET so I don't have a ton of code to describe, unfortunately.

I was trying to follow their pattern which I will briefly describe here:

I have a DataGridView whose DataSource property points to a BindingSource. The BindingSource points to a DataSet. The editor for that DataSet calls a TableAdapter which gets the data from the stored procedure.

I previewed the data for the TableAdapter. The data is there. On frmMain's load the TableAdapter's Fill command is run.

Not seeing anything. And my hunch is that this is way too complex a process to be correct. Or maybe not. I did a lot of Google searches before I decided to bother you fine folks.

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

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

发布评论

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

评论(1

弱骨蛰伏 2024-07-21 12:46:40

也许你做了类似的事情:(

datagridview.datasource = ds

这将向你显示一个空网格)

尝试

datagridview.datasource = ds.tables(0)

Maby you did something like:

datagridview.datasource = ds

(That will show you an empty grid)

Try

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