title: Student attendance time in time out
body: <p>i made a student attendance system using barcode scanner and its already working the time in time out works well but my problem is this after the student scan his/her barcode for time out the next time he/she scan his/her barcode the remarks should be time in but my code only sticks with a time out remarks.</p>
  
  <p>this is my code for time in time out</p>
  
  <pre><code> 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='" &amp; student.Text &amp; "'"
          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 &amp; ".bmp")
              PictureBox1.Image = Image.FromFile(filename)
              FULLNAME.Text = dbread.Item(1).ToString &amp; " " &amp; dbread.Item(2).ToString &amp; " " &amp; 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 = '" &amp; student.Text &amp; "' AND (remarks &lt;&gt;'IN' OR remarks &lt;&gt;'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 ('" &amp; student.Text &amp; "','" &amp; LBLTime.Text &amp; "','" &amp; LBLDate.Text &amp; "','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 ('" &amp; student.Text &amp; "','" &amp; LBLTime.Text &amp; "','" &amp; LBLDate.Text &amp; "','OUT')"
              dbcomm = New MySqlCommand(sql, dbconn)
              dbread = dbcomm.ExecuteReader()
              dbread.Close()
  
              dbconn.Close()
              Search_Code()
  
          End If 
      End If
  </code></pre>