Dim cnt As Integer
Dim lj As Boolean = False
Dim str As String = "详|调|合|离|员|离职时间|备注|系统密码|系统开启|系统在线与否|空白单元格|信息完整率"
Dim Values() As String
Values = Str.split("|")
For Each cl As DataCol In dt.datacols
lj = False
For Index As Integer = 0 To Values.Length - 1
If Values(Index) = cl.name Then
lj = True
End If
Next
If lj = False Then
cnt = cnt + dt.Compute("Count([_identify])", cl.Name & " Is not NULL ")
End If
Next
之前想这样写的 但是出错
Dim str As String = "详|调|合|离|员|离职时间|备注|系统密码|系统开启|系统在线与否|空白单元格|信息完整率"
For Each cl As DataCol In dt.datacols
If cl.name not In str.Split("|") Then
cnt = cnt + dt.Compute("Count([_identify])", cl.Name & " Is not NULL ")
End If
Next
此主题相关图片如下:1111.jpg

最原始的代码 判断太累了
Dim cnt As Integer
For Each cl As DataCol In dt.datacols
If cl.name <> "详" And cl.name <> "调" And cl.name <> "合" And cl.name <> "离" And cl.name <> "员" And cl.name <> "离职时间" And cl.name <> "备注" And cl.name <> "系统密码" And cl.name <> "系统开启" And cl.name <> "系统在线与否" And cl.name <> "空白单元格" And cl.name <> "信息完整率" Then
cnt = cnt + dt.Compute("Count([_identify])", cl.Name & " Is not NULL ")
End If
Next
[此贴子已经被作者于2012-5-18 12:55:49编辑过]