以编程方式向绑定到数据集的datagridview添加新行 [英] add new row progamtically to datagridview bound to dataset
本文介绍了以编程方式向绑定到数据集的datagridview添加新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个DataGridView我已使用数据连接向导绑定到ms-access数据库
当我尝试以编程方式向DataGridView添加新行然后进行更新时,它说
i have a DataGridView i bound to ms-access database using data connection wizard
when i try to add new row to the DataGridView programatically then update, it says
Rows cannot be pro grammatically added to the DataGridView''s rows collection when the control is data-bound.
how do i correct this.
推荐答案
在这里, ^ ]必须说点什么:
相似的讨论1 [ ^ ]
已报告给Microsoft的问题及其回复 [
Here, Google search[^] has to say something:
Similar discussion 1[^]
Issue reported to Microsoft and their reply[^]
如果您定义了带有单个datatable
的强类型dataset
,则您可以使用它并获得一些不错的强类型方法来完成这些工作,而不必依赖于网格方法
If you have defined a strongly-typeddataset
with a singledatatable
then you could use that and get some nice strongly typed methods to do this stuff rather than rely on the grid methods
DataSet1.DataTable.AddRow(NewRow)
试试
以编程方式将行添加到DataGridView [ ^ ]
或者,
^ ]
Try
Programmatically Add Rows to DataGridView[^]
or,
MSDN-Search[^]
这篇关于以编程方式向绑定到数据集的datagridview添加新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文