使用 DataGridView 更新多个表 [英] Using DataGridView to Update Multiple Tables

查看:32
本文介绍了使用 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 更新多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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