Dim cmd As OdbcCommand = New OdbcCommand("SELECT distinct checktime,format(CHECKTIME,'Short Date') as adlaws, format(CHECKTIME,'ampm') as formatz,checktype " & _" from CHECKINOUT where userid=" & Label6. #" & FormatDateTime(DateTimePicker1.Value, DateFormat.ShortDate) & _ "# and #" & FormatDateTime(DateTimePicker2.Value, DateFormat.ShortDate) & "#", con)
Try
Dim dr As OdbcDataReader
ListView1.Items.Clear()
dr = cmd.ExecuteReader
MsgBox(i & " " & adlawan)
Do While dr.Read()
Dim Str1 As String = dr.Item("adlaws").ToString
Dim Str2 As String = dr.Item("formatz").ToString
Dim Str3 As String = dr.Item("checktype").ToString
sLog = FormatDateTime(dr.Item("CHECKTIME").ToString, DateFormat.ShortDate)
sTime = FormatDateTime(dr.Item("CHECKTIME").ToString, DateFormat.ShortTime)
adlawan = Val(Mid(sLog, 3, 2))
' MsgBox(i & " " & adlawan)
' If adlawan = i Then
'lv = ListView1.Items.Add(adlawan)
Select Case Str3
Case "I"
If Val(Mid(sTime, 1, 2)) > 3 And Val(Mid(sTime, 1, 2)) < 10 Then
lv = ListView1.Items.Add(adlawan)
a = FormatDateTime(dr.Item("CHECKTIME").ToString, DateFormat.ShortTime)
lv.SubItems.Add(a)
Else
d = FormatDateTime(dr.Item("CHECKTIME").ToString, DateFormat.ShortTime)
lv.SubItems.Add(d)
End If
Case "O"
If Val(Mid(sTime, 1, 2)) > 10 And Val(Mid(sTime, 1, 2)) < 17 Then
b = FormatDateTime(dr.Item("CHECKTIME").ToString, DateFormat.ShortTime)
lv.SubItems.Add(b)
Else
c = FormatDateTime(dr.Item("CHECKTIME").ToString, DateFormat.ShortTime)
lv.SubItems.Add(c)
End If
End Select
阿德拉旺 = 阿德拉旺 + 1
Loop
con.Close()
Catch oe As OdbcException
MsgBox(oe.Message)
End Try