日期:2014-05-18  浏览次数:20801 次

string code = cmbCode.SelectedValue.ToString();,code 值为System.Data.DataRowView
code断点调试出来的值是System.Data.DataRowView,是什么地方错了

------解决方案--------------------
你没有绑定ValueMember的值吧,比如ComboBox.ValueMember=ZipCode

,如果想获得显示的值,用ComboBox.DisplayMember

msdn解释
If a property is not specified in ValueMember, SelectedValue returns the results of the ToString method of the object.