下面的循环让我疯了,因为它不是他们的裸体记录,即使它不是他们的一个c#程序员过渡可以有人帮助并告诉我这里我做错了什么
WriteToLogAndRaiseFeedback("Setting Department Codes Started " & Now.ToShortTimeString(), True)
Dim i As Int16
i = 0
For Each thisEntry As DataRow In findDepartmentsForGemini.Rows
i = i + 1
connection.ExecuteNonQuerySql(scriptBuilder.setGeminiDepartmentCodes(findDepartmentsForGemini.Rows(i).Item(0), findDepartmentsForGemini.Rows(i).Item(2)))
Next
WriteToLogAndRaiseFeedback("Setting Department Codes Completed" & Now.ToShortTimeString(), True)
答案 0 :(得分:3)
数组从索引0开始,因此,在访问行之前,您对变量i的增量会导致跳过第一行。
但是,不清楚为什么需要将此变量用作索引器 由于foreach触发的枚举器
,您已经在DataRow上使用了您想要使用的引用For Each thisEntry As DataRow In findDepartmentsForGemini.Rows
connection.ExecuteNonQuerySql(scriptBuilder.setGeminiDepartmentCodes _
(thisEntry.Item(0), thisEntry.Item(2)))