如何从数据集中向datagridview添加一条记录? [英] How to add one record to datagridview from dataset?

查看:62
本文介绍了如何从数据集中向datagridview添加一条记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据集中有一些记录.将此表绑定到datagridview
我正在使用此代码

I have some records in my dataset.To bind this table to datagridview
i am using this code

datagridview1.datasource=ds.tables[0];


但是我不想将所有记录都绑定到gridview.我只想绑定一个记录.有任何帮助吗?


But i don''t want to bind all records to gridview.I want to bind only one record.any one help?

推荐答案

制作一张新的过滤器数据表您要显示并将其绑定到datagridview

您可以通过foreach循环过滤数据,也可以使用linq
Make a new table of filter data which you wants to display and bind it to datagridview

You can filter data by foreach loop or you can use linq


在数据源中使用过滤器,就这么简单.

使用BindingSource和DataView过滤在DataGridView中显示的数据 [
Use Filter in Datasource, that''s all.

Filter data dispalyed in a DataGridView using BindingSource and DataView [^]


这篇关于如何从数据集中向datagridview添加一条记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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