zoukankan      html  css  js  c++  java
  • 去除Linq to Sql 查询结果中的空格

    原来的写法:

    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了。

  • 相关阅读:
    16款值得一用的iPhone线框图模板 (PSD & Sketch)
    设计神器
    {CF812}
    hiho1080(多标记线段树)
    {容斥原理}
    {dp入门}
    {AC自动机}
    CF807
    Trie树
    杂记
  • 原文地址:https://www.cnblogs.com/lxzhangying/p/5076980.html
Copyright © 2011-2022 走看看