when Register in this also will record the time in to access also is this code corrct
this my code
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
lbltime.Text = "Time:" + TimeString
If String.IsNullOrWhiteSpace(txtadmno.Text) Or String.IsNullOrWhiteSpace(txtcard.Text) Then
'MessageBox.Show("Please complete the on the box.", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Using conn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb")
lbltime.Text = TimeOfDay.Hour & ":" & TimeOfDay.Minute & ":" & TimeOfDay.Second
If TimeOfDay.Second < 10 Then
Dim fitsecond As String
fitsecond = TimeOfDay.Second
lbltime.Text = TimeOfDay.Hour & ":" & TimeOfDay.Minute & ":" & "0" & fitsecond
End If
If TimeOfDay.Minute < 10 Then
Dim fitminute As String
fitminute = TimeOfDay.Minute
lbltime.Text = TimeOfDay.Hour & ":" & "0" & fitminute & ":" & TimeOfDay.Second
End If
If TimeOfDay.Hour < 10 Then
Dim fithour As String
fithour = TimeOfDay.Hour
lbltime.Text = "0" & fithour & ":" & TimeOfDay.Minute & ":" & TimeOfDay.Second
End If
Dim sql As String = "insert into tbl_studentadm (TimeIn, TimeOut) WHEN ([Stud Admin], [Admin Card]) = '" & txtadmno.Text & "' AND = '" & txtcard.Text & "'"
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, Conn)
sqlCom.Connection = Conn
conn.Open()
Dim result As Integer = sqlCom.ExecuteNonQuery()
sqlCom.Dispose()
Conn.Close()
If result > 0 Then
MessageBox.Show("Insert time in.")
Else
MessageBox.Show("Failure to time in.")
End If
End Using