dataGridView不更新C#? [英] dataGridView not updating c#?
本文介绍了dataGridView不更新C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用下面的代码填充了datagridView
I have filled the datagridView using the code below
this.empinfoTableAdapter1.Fill(this.empData.empinfo);
但是当我从gridview更新表时,它更新了原始数据库。但未在表单中显示更新。
but when i am updating the table from gridview its updating the orginal database. But not showing the update in the form.
我搜索了google,发现了类似的问题。但是大多数都是自定义数据绑定。不使用
I have searched google and found similar question. But most of them are custom data binding. Not using
this.empinfoTableAdapter1.Fill(this.empData.empinfo);
所以,我发布了问题。
推荐答案
如果它是ASP.Net应用程序,则需要调用 DataBind()
,例如:
If it is ASP.Net application then you need to call DataBind()
like:
GridView1.DataBind();
如果使用WinForm应用程序,则需要分配 DataSoure
像这样:
If its WinForm application then you need to assign the DataSoure
again like:
GridView1.DataSource = this.empData.empinfo;
这篇关于dataGridView不更新C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文