数据集中的UPDATE / DELETE / INSERT [英] UPDATE/DELETE/INSERT in dataset

查看:90
本文介绍了数据集中的UPDATE / DELETE / INSERT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个数据集从xml文件填充并具有以下结构。



{Id},{Name },{Amount}



我想

1)更新此数据集中的特定ID的名称和金额

2)从数据集中删除具有特定id的记录

3)如果数据集中不存在特定id,则在数据集中插入新记录。





请让我知道代码。

Hello all,
I have one dataset which populating from xml file and has below stucture.

{Id},{Name},{Amount}

I want to
1) Update name and amount in this dataset for particular id
2) Delete record which has particular id from dataset
3) Insert new record in dataset if particular id is not present in dataset.


Please let me know the code.

推荐答案

这应该不是问题,请参阅更新数据集中的现有记录 [ ^ ]



干杯,

Edo
That shouldn''t be a problem, see Updating Existing Records in a Dataset[^]

Cheers,
Edo


在datatable中使用.select方法。这个方法的parater是一个字符串。您可以在此处指定过滤条件。过滤后的记录将作为数据行集合。从该集合中,您可以更新任何记录。如果您的标准没有记录,则可以直接将该行添加到数据表中。
Use .select method in datatable. The parater for this method is a string. You can specify the filter condition here. The filtered records will be come as Data Row collection. From that collection you can update any record. if no records for your criteria u can directly add that row into the datatable.


这篇关于数据集中的UPDATE / DELETE / INSERT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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