Dim cmd As New SQLCommand
cmd.Connecti
cmd.CommandText = "Select distinct 巡察对象属性 From {巡察工作安排}"
Dim dt As DataTable
dt = cmd.ExecuteReader()
Dim Products As List(Of String)
Products = dt.GetValues("巡察对象属性")
Dim time As String = Date.today.Year
Dim y As Integer = time '指定年份
Dim time1 As New Date(y, 1, 1)
Dim time2 As New Date(y, 12, 31)
cmd.CommandText = "Select * From {巡察工作覆盖情况} where [_identify] = -1"
Dim dt1 As DataTable
dt1 = cmd.ExecuteReader(True)
Dim bb As DataRow = dt1.AddNew
Dim yxs As Integer
Dim yxs1 As Integer
Dim bnd As Integer
For Each Product As String In Products
Dim cl As String = Product & "_应巡数"
Output.Show(cl)
If dt1.DataCols.Contains(cl) Then
cmd.CommandText = "Select Count(*) From {巡察对象信息} Where 巡察对象属性 = '" & Product & "'"
Dim sl2 As Integer = cmd.ExecuteScalar
If sl2 > 0 Then
bb(cl) = sl2
yxs = yxs + sl2
End If
End If
cl = Product & "_已巡数"
If dt1.DataCols.Contains(cl) Then
cmd.CommandText = "Select Count(*) From {巡察工作安排} Where 巡察对象属性 = '" & Product & "'"
Dim sl2 As Integer = cmd.ExecuteScalar
If sl2 > 0 Then
bb(cl) = sl2
yxs1 = yxs1 + sl2
End If
End If
cl = Product & "_本年度"
If dt1.DataCols.Contains(cl) Then
cmd.CommandText = "Select Count(*) From {巡察工作安排} Where 巡察对象属性 = '" & Product & "' and 巡察开始时间 >= '" & time1 & "' And 巡察开始时间 <= '" & time2 & "'"
Dim sl2 As Integer = cmd.ExecuteScalar
If sl2 > 0 Then
bb(cl) = sl2
bnd = bnd + sl2
End If
End If
Next
output.show(yxs)
bb("总计_应巡数") = yxs
bb("总计_已巡数") = yxs1
bb("总计_覆盖率") = bnd
bb.save