vb.net Linq 筛选(像 select distinct) DateTable 日期数据中的年份

    Private Sub initDDLByYear(ByVal dt As DataTable)

        ddlByYear.Items.Clear()
ddlByYear.Items.Add(New ListItem(GetGlobalResourceObject("Resource1", "All"), "")) If Not dt Is Nothing Then
Dim years = (From r In dt.AsEnumerable
Select DateTime.Parse(r("create_date").ToString()).ToString("yyyy")).Distinct For Each y In years
ddlByYear.Items.Add(New ListItem(y.ToString, y.ToString))
Next End If End Sub
上一篇:阅读


下一篇:如何使用laravel搭建后台登录系统