本文介绍了如何在datagridview中将数据库值绑定到datagridviewcomboboxcolumn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在开始使用winforms
我不知道如何将数据库值绑定到datagridview中的datagridviewcomboboxcolumn.
谁能告诉我如何绑定以及如何执行(CRUD)操作.
在此先感谢............................
hi everybody,
i am starting of the winforms
i don''t know how to bind the database value to datagridviewcomboboxcolumn in datagridview.
can you any body tell me how can i bind and how can i do (CRUD) operations.
thanks in advance......................
推荐答案
DataGridViewComboBoxColumn dc = new DataGridViewComboboxColumn();
dc.DataSource = dt;
dc.ValueMember = "ID";
dc.TextMember = "Name";
DataGridView1.Columns.Add("ColumnName", dc);
其中dt = datatable
存储ID和名称.
试试这个.
where dt = datatable
which is store the ID and Name.
Try this.
这篇关于如何在datagridview中将数据库值绑定到datagridviewcomboboxcolumn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!