0
對不起英文不好;LINQ如何處理空值
我的代碼;
Dim otherDT As DataTable = retDS1.Tables(0)
Dim dt As New DataTable
dt.Columns.Add("COGRAFI_BOLGE_ADI")
dt.Columns.Add("Count")
Dim query = (From dr In (From d In otherDT.AsEnumerable Select New With {.COGRAFI_BOLGE_ADI = d("COGRAFI_BOLGE_ADI")}) Select dr.COGRAFI_BOLGE_ADI Distinct)
For Each colName As String In query
Dim cName = colName
Dim cCount = (From row In otherDT.Rows Select row Where row("COGRAFI_BOLGE_ADI").ToString = cName).Count
dt.Rows.Add(colName, cCount)
Next
GridView1.DataSource = dt
GridView1.DataBind()
某些行包含空值; 如何處理空行?
輸出:
Marmara 40
Ege 10
Akdeniz 2
...
可能重複http://stackoverflow.com/questions/15580008/怎麼辦,我檢查換使用,LINQ到SQL基本無效值 – DevelopmentIsMyPassion