如何在datagridview中编辑和保存?在C#.net Windows应用程序中 [英] how to edit and save in datagridview? in c# .net windows application

查看:462
本文介绍了如何在datagridview中编辑和保存?在C#.net Windows应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在datagridview上进行编辑和保存?

我正在使用ms Access数据库.现在,表通过datagridview从数据库中检索.在这里,我想在datagridview上编辑并将更改保存到数据库后如何?

请给我打电话.我正在等待您的答复.

how to edit and save on datagridview?

I am using ms access database. Now tables retrieve from the database through the datagridview. here after i want edit on datagridview and save changes to the database how is it?

pls tel me. i am waiting for your response.

推荐答案

数据集是所有操作的主要部分.

1.从数据库中获取数据集中的值.
2.将其与gridview绑定.将gridview设置为可编辑(因此,用户可以编辑值
他们想要的)
3.编辑后,将gridview表放入数据集.
4.最终将数据集更新到数据库.

Gridview更改为数据集.

Dataset is the main part in all your operations.

1. Fetch the values in dataset from database.
2. Bind it with gridview. Put gridview editable (so user edit values whatever
they want)
3. after editing put gridview table to dataaset.
4. finally update dataset to database.

Gridview changes to dataset.

DataTable dt = (DataTable)GridView1.DataSource; 
 Dataset ds = new dataSet;
 ds.tables[0] =  dt



然后将数据集更改保存到数据库 [ ^ ]



and then Save Dataset Changes to a Database[^]


通过分页在DataGridView中添加,编辑和删除 [ ^ ]


此问题前段时间被问到:
.net中的数据网格视图 [
This Question was asked some time ago:
datagrid view in .net[^]


这篇关于如何在datagridview中编辑和保存?在C#.net Windows应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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