如何用新数据填充数据表而不将其附加在旧数据上? [英] How to Fill a datatable with new data not append on the old data?

查看:54
本文介绍了如何用新数据填充数据表而不将其附加在旧数据上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果datatable有3行,现在使用dataadapter填充行的集合(假定3行),那么它就变成了6行,因为没有删除3个旧行.我先通过清除该数据表中的行,然后开始填充它来解决此问题.
还有其他更简单的方法吗?

If datatable has 3 rows, now use dataadapter to fill a collection of rows (suppose 3 rows), then it comes to 6 rows because the 3 old rows are not removed. I work around this by clearing rows in that datatable first then starting filling it.
Do we have another way simpler?
Your help would be highly appreciated!

推荐答案

检查这些博客
http://imar.spaanjaars.com/406/filling-a- datatable-or-dataset-the-quick-way [ ^ ]
http://msdn.microsoft.com/en-us/library/905keexk.aspx [ ^ ]
--NDK
check these blogs
http://imar.spaanjaars.com/406/filling-a-datatable-or-dataset-the-quick-way[^]
http://msdn.microsoft.com/en-us/library/905keexk.aspx[^]
--NDK


亲爱的朋友,

除了清除行以外,没有其他方法可以覆盖数据表上的数据.请按照以下链接进行操作:-

http://www.vbdotnetforums.com/database-general-discussion/18908-overwriting-datatable-new-values.html [ ^ ]

谢谢

Varun Sareen
Dear Friend,

There is no other way to overwrite data on a datatable other than to clear the rows. Please follow the link for your confusion:-

http://www.vbdotnetforums.com/database-general-discussion/18908-overwriting-datatable-new-values.html[^]

Thanks

Varun Sareen


您好,请先使用"DataTable.Clear()",然后再使用dataadapter填充数据表中的行集合.它从数据表中删除所有数据.请尝试一下.
Hi use "DataTable.Clear()" before use dataadapter to fill a collection of rows in datatable. It removes all the data from datatable. It will work, pls try this.


这篇关于如何用新数据填充数据表而不将其附加在旧数据上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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