我正在研究自动合规工具,并遇到了以下问题:
我正在生成目前看起来像这样的Excel工作表(由于公司数据而使用虚拟数据):
但实际应该看起来像这样(不是实际数据):
在名为getRightsForPath()
的函数中使用以下查询从数据库中提取信息:
"SELECT DUMPSEC.rights
FROM DUMPSEC
WHERE DUMPSEC.location ='" & sql2 & "'
AND DUMPSEC.members = '" & sql1 & "'"
这是应该处理添加到正确单元格的权限的循环:
For i = 1 To groupCounter Step +1
Dim rights = getRightsForPath(sourceLocation, xlWorksheet.Cells(2, i + 1).Value, xlWorksheet.Cells(Row, 1).Value)
Do While rights.Read()
xlWorksheet.Cells(Row, i + 1) = rights("rights")
//MessageBox.Show(locations("location") & ", " & groupOwnerOf("groupname") & ", " & rights("rights"))
Loop
Next
Row += 1
答案 0 :(得分:0)
For Row = 3 To locationCount Step +1
For i = 2 To groupCounter + 1 Step +1
Dim rights = getRightsForPath(sourceLocation, xlWorksheet.Cells(2, i).Value, xlWorksheet.Cells(Row, 1).Value)
Do While rights.Read()
xlWorksheet.Cells(Row, i) = rights("rights")
Loop
Next
Next