我需要此代码的帮助..它已成功添加,但它不会从每个数据库记录中循环..我的数据库中有 3 条记录,但他只检测到 1 条,我使用循环..它不会循环并添加到它..对修改此代码有任何帮助吗?
我有来自字段名的 3 条记录:dtr_grantotal:
- = 10:41:00
- = 01:11:00
= 03:30:10
sqlSTR = "select * from tblTImelog where dtr_datelog Between '" & DateTimePicker1.Text & "' AND '" & DateTimePicker2.Text & "'" ExecuteSQLQuery(sqlSTR) _totalDays = sqlDT.Rows.Count If sqlDT.Rows.Count > 0 Then Dim T1 As String = "00:00:00" Dim myRow As DataRow = sqlDT.Rows(sqlDT.Rows.Count - 1) Dim span1 As TimeSpan = TimeSpan.Parse(T1) For i = 0 To sqlDT.Rows.Count - 1 Dim span2 As TimeSpan = TimeSpan.Parse(sqlDT.Rows(i)("dtr_grandtotal")) t1 = span1.Add(span2).ToString Next MsgBox(t1) End If
他只从我的 msgbox 中显示第一个.. 虽然我在我的 for 循环中添加了它..