Dim kmdm As String = "1001" Dim dt As DataTable = DataTables("会计科目") Dim filter As String = "开始日期 IS NOT NULL and 科目代码 like '" & kmdm & "%'" Dim StartDate As Date = dt.Compute("Min(开始日期)", filter) Dim EndDate As Date = dt.Compute("Max(完成日期)", filter) msgbox(startdate & " " & Enddate) Dim sp As TimeSpan = Enddate - startdate msgbox(sp.TotalDays)