每天点击一次,当我点击我的卡时会无限次超时,我只需要出勤一天即可。
query = "select Name from tbl_time where Name='" & lblName.Text & "' and `Date`=curdate() and Time_out='' "
cmd = New MySqlCommand(query, conn)
dr = cmd.ExecuteReader
If dr.Read Then
dr.Close()
Dim ins As New MySqlCommand("Select* from tbl_time where Name,Time_in", conn)
ins.ExecuteNonQuery()
MsgBox("You're already login")
ElseIf dr.Read Then
Dim Tout = dr.GetString(0)
dr.Close()
Dim ins As New MySqlCommand("update tbl_time set Time_out=curtime() where Name='" & Tout & "'", conn)
ins.ExecuteNonQuery()
Console.Beep(1000, 50)
timeLog.Text = "TIME OUT " & DateTime.Now.ToString()
sapi.speak(timeLog.Text)
Else
dr.Close()
Dim ins As New MySqlCommand("Insert into tbl_time values('','" & lblName.Text & "','" & lbladdress.Text & "',curdate(),curtime(),'')", conn)
ins.ExecuteNonQuery()
Console.Beep(1000, 50)
timeLog.Text = "TIME IN " & DateTime.Now.ToString()
sapi.speak(timeLog.Text)
End If
每天点击一次,当我点击我的卡时会无限次超时,我只需要出勤一天即可。