使用 DataGridView 更新多个表

编程入门 行业动态 更新时间:2024-10-14 14:16:39
本文介绍了使用 DataGridView 更新多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在 VB.NET 2008 表单上,我有一个 DataGridView、BindingSource 和 TableAdapter.

On a VB.NET 2008 form I have a DataGridView, BindingSource and TableAdapter.

BindingSource DataSource 是一个数据集.

The BindingSource DataSource is a dataset.

在数据集中,我有一个连接三个表的填充命令,它在 DataGridView 中显示没有问题.

In the dataset I have a Fill command that joins three tables and this is displayed without a problem in the DataGridView.

但是,我无法更新 dataGridView,因为它有来自单个 TableAdapter 的多个表?

However, I am unable to Update the dataGridView because it has multiple tables from a single TableAdapter?

有谁知道我可以更新的简单方法.这些表有 200 多列,我只想更新已更改的列.如果我使用单个表,我可以在 DataGridView 中编辑数据并且数据库更新正常.

Does anyone know a simple way I can update. The tables has over 200 columns and I only want to update the columns that are changed. If I use a single table I can edit data in the DataGridView and the database is updated ok.

任何帮助将不胜感激?

谢谢.

推荐答案

不幸的是,Windows.Forms BindingSource 不支持复杂的属性(我假设你在使用它).

Unfortunately, the Windows.Forms BindingSource, does not support complex properties (which I assume you are after).

您必须制作自己的自定义 BindingSource(可能会为您定制​​)来处理复杂的属性值和分配.

You would have to craft your own custom BindingSource (and it will likely be bespoke to you) to handle complex property values and assignments.

更多推荐

使用 DataGridView 更新多个表

本文发布于:2023-10-26 17:37:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530860.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   DataGridView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!