【发布时间】:2014-02-05 20:21:54
【问题描述】:
我在我的 WinForm 应用程序中收到此错误:
不支持直接将数据绑定到存储查询(DbSet、DbQuery、DbSqlQuery)。而是使用数据填充 DbSet,例如通过在 DbSet 上调用 Load,然后绑定到本地数据。对于 WPF 绑定到 DbSet.Local。对于 WinForms 绑定到 DbSet.Local.ToBindingList()。
这是我的代码:
private DataBaseEntities entity = new DataBaseEntities();
categoryComboBox.DataSource = entity.TableName;
categoryComboBox.DisplayMember = "Description";
//ProductType is the Primary Key of the table and is Identity as well
//And when the compiler arrives here, the error is thrown
categoryComboBox.ValueMember = "ProductType";
有人可以帮我解决我的错误吗?
【问题讨论】:
标签: c# winforms visual-studio-2012 error-handling