我有一个datagridview
包含用户可以更新的项目列表。项目数据来自tblitems
其中有一列categoryId
。我combobox column
从. value member
_ categoryId
_ tblitems
_ display member
_ tblcategories
现在,我想填充数据tblitems
并将类别 id 与类别 id 相匹配tblitems
。当我这样做时,它会给我一个数据不匹配错误。我该如何解决这个问题?
谢谢
更新: 这是代码:
//conn.getDataTable is just a method to return datatable.
category_id.DataSource = conn.getDataTable("Select category_id from tblcategories");
category_id.DisplayMember = "category_id";
category_id.ValueMember = "category_id";
DataTable items = conn.getDataTable("Select itemname,itemprice,category_id from tblitem");