VB.net RFID recording Time In/Out and save it into the database. I`m begging for HELP!

  • Thread starter Thread starter Nhovie
  • Start date Start date
N

Nhovie

Guest
I am doing a system which is a Gate Pass ID System using RFID. but im stock on how to record its time in/out (Labeltimeinout.text) in my database(mySQL) and displays "IN" on the first tap and "OuT" on the second tap. 7 days left and I`m still stuck here =( here`s my code...



Imports MySql.Data.MySqlClient

Public Class MainDisplay
Dim str As String = "server=localhost; user id=root;pwd=; database=userinfo"
Dim con As New MySqlConnection(str)
Public idnumber As String

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBoxTag.KeyPress

If Asc(e.KeyChar) = "13" Then
Dim sqlreader As MySql.Data.MySqlClient.MySqlDataReader
con.Open()
Dim query As New MySqlCommand("select concat_ws('',LastName,',',FirstName,',',MiddleName) as FullName,concat_ws('',Year,'-',Course) as YearCourse, IDNumber from userinformation where RFIDTag='" & TextBoxTag.Text & "'", con)
Dim D As Date = Now()

sqlreader = query.ExecuteReader
sqlreader.Read()


LabelName.Text = sqlreader.Item("FullName")
LabelYearCourse.Text = sqlreader.Item("YearCourse")
LabelIDNum.Text = sqlreader.Item("IDNumber")


sqlreader.Close()

LabelTimeInOut.Text = Format(Now, "hh:mm:ss tt")
TextBoxTag.Text = ""
LabelStatus.Text = ""

End If


End Sub


Private Sub MainDisplay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
labelDateInOut.Text = DateAndTime.Now.ToString("MM-dd-yyyy")
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
labelmdtime.Text = TimeOfDay.ToString("hh:mm:ss tt")

End Sub


Private Sub ButtonMDBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMDBack.Click
Me.Close()
FormMenu.Show()
End Sub


Private Sub TimerLabel_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerLabel.Tick
If TimerLabel.Interval = 1000 Then
TimerLabel.Stop()
LabelName.Text = ""
LabelYearCourse.Text = ""
LabelIDNum.Text = ""
LabelStatus.Text = ""
PictureBox.Image = Nothing
End If

End Sub

Continue reading...
 
Back
Top