首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

string code = cmbCode.SelectedValue.ToString();code 值为System.Data.DataRowView解决办

2012-04-25 
string code cmbCode.SelectedValue.ToString(),code 值为System.Data.DataRowViewcode断点调试出来的

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.

热点排行