datagridview更新 [英] datagridview update
本文介绍了datagridview更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过从sql插入或删除后更新datagridview的方式,像这样;
ds.Clear() ;
da.Fill(ds);
dataGridView2.DataSource = ds.Tables [0];
da和ds定义如下:
da = new SqlDataAdapter(sqlcommand);
ds = new DataSet();
解决方案
我找到答案。
这里是链接
I have a datagridview whose source is a datatable. There are orders and food names columns. I insert new values into the this datagridview and delete from the table. when I select one row and delete it, selected color moves to the top, and if I want to delete one more order for same food, I have to reclick it each time. How can I solve this problem? by the way I update the datagridview after inserting or deleting from sql, like this;
ds.Clear();
da.Fill(ds);
dataGridView2.DataSource = ds.Tables[0];
da and ds is defined like this;
da = new SqlDataAdapter(sqlcommand);
ds = new DataSet();
解决方案
I found the answer. Here is the link
这篇关于datagridview更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文