首页 > 技术文章 > C# 获取DataGridView 改变值的数据

LuoCore 2021-09-17 20:04 原文

 
 
//先给 DataGridView 赋值一个空表
DataSet ds_temp = 数据库.getDs("select *  from  表名 where 1=0");
            if (ds_temp != null && ds_temp.Tables.Count > 0)
            {
                rcomdgv1.DataSource = ds_temp.Tables[0];
            }


//获取新增内容
rcomdgv1.CurrentCell = null;
 if (ds_temp.HasChanges())
{
                    var dsChanges = ds_temp.GetChanges();
                    if (dsChanges != null && dsChanges.Tables.Count < 1) { return; }


                 
                }

 

推荐阅读