VB
VB学习者的乐园
posts - 34,  comments - 35,  trackbacks - 0

原来的写法:

Dim db = From city In DataContext1.AddressCity

               Where city.ProvinceID = dgvAddress(2, e.RowIndex).Value.ToString  、

               Select city.CityID, city.CityName.Trim

可以去掉CityName中的空格,但是db中的列名改变了,在绑定Combobox中出现了错误。

修改后的写法:

Dim db = From city In DataContext1.AddressCity
                         Where city.ProvinceID = dgvAddress(2, e.RowIndex).Value.ToString
                         Select New With {.CityID = city.CityID, .CityName = city.CityName.Trim}

可以正确绑定Combobox了。

posted on 2015-12-25 20:57 天使爱比目鱼 阅读(...) 评论(...) 编辑 收藏