我使用条形码扫描仪制作了一个学生出勤系统,并且它的工作时间已经很好但是我的问题是在学生扫描他/她的条形码下次他/她扫描他/她的条形码之后的时间这些评论应该是时间,但我的代码只是留出时间的评论。
这是我的时间代码
Dim check As Boolean
Call connect()
Dim cmdd As New MySqlCommand("Select Count(*) from attendance_for_student WHERE Remarks = 'IN' ", dbconn)
Dim i As Integer = cmdd.ExecuteScalar()
cmdd = Nothing
dbconn.Close()
TextBox1 .Text = i
If student.Text = "" Then
MsgBox("Scan Your Code!", MsgBoxStyle.Critical)
Else
Call connect()
sql = "SELECT * FROM student WHERE Sbarcode='" & student.Text & "'"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader
Do While dbread.Read
Dim id As String = student.Text
Dim folder As String = "c:\jpnhs\"
Dim filename As String = System.IO.Path.Combine(folder, id & ".bmp")
PictureBox1.Image = Image.FromFile(filename)
FULLNAME.Text = dbread.Item(1).ToString & " " & dbread.Item(2).ToString & " " & dbread.Item(3).ToString
Loop
dbread.Close()
dbconn.Close()
End If
If Len(student.Text) = 8 Then
Call connect()
check = False
sql = "SELECT * FROM attendance_for_student WHERE Sbarcode = '" & student.Text & "' AND (remarks <>'IN' OR remarks <>'OUT')"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader
Do While dbread.Read
check = True
Loop
dbread.Close()
dbconn.Close()
If check = False Then
Call connect()
sql = "INSERT INTO attendance_for_student(Sbarcode,Time,Date,remarks) VALUES ('" & student.Text & "','" & LBLTime.Text & "','" & LBLDate.Text & "','IN')"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
dbread.Close()
dbconn.Close()
Search_Code()
Else
Call connect()
sql = "INSERT INTO attendance_for_student(Sbarcode,Time,Date,remarks) VALUES ('" & student.Text & "','" & LBLTime.Text & "','" & LBLDate.Text & "','OUT')"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
dbread.Close()
dbconn.Close()
Search_Code()
End If
End If