求助?怎样解决combobox绑定数据源的内容全是一样的情况?
代码如下:
实现层:
List<Device> typeidList = new OperateModel().QueryType();
cbx_type.DataSource = typeidList;
模型层:
public class Device
{
public int Id { get; set; }
public string Name { get; set; }
public int ModelId { get; set; }
public int TypeId { get; set; }
}
操作层:
OperateModel类:
public List<Device> QueryType()
{
return new DataQuery().QueryTypeId();
}
QueryType类:
public List<Device> QueryTypeId()
{
String strsql = "select TypeId from Device Where Order By Id";
return new SQLHelperChange().ReaderToList<Device_Record>(new SQLHelper().SelectReader(strsql));
}
最后combobox实现的结果是DeviceModel.Device,我知道是属性被绑定进来,想知道下怎样可以把TypeId属性绑定进来??