开发者

Combobox displaying duplicate items

I have a combo box that I开发者_如何转开发 am binding from a sql server database. I am binding one column from the database into the combo box. The problem is that I get the same item showing up in there several times. I am querying from a stored procedure. Let me know if there is anything obvious that I am missing. Thanks

public void BindComboBox()
{
   _dsinventory = new DataSet();
   _dsinventory = dbAccess.ExecuteQuery(InventoryOutputQuery.ComboBox_Type());
   cmbType.ItemSource = _dsinventory.Tables[0].DefaultView;
   cmbType.DisplayMemberPath = _dsinventory.Tables[0].Columns[Type].ToString();
}


try distinct keyword in you select query

 Select distinct columnname form table


DISTINCT should only be used when you are sure that the query is all fine.

Double check the query you are using, and then go for DISTINCT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜