in Student Register_Form i key in the Stud Admin and admin card but when i key in the admin card one number it come out alot of small box that say (Insert time in)
here is all the code:
Public Class Student_Form
Private Sub btnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegister.Click
If String.IsNullOrWhiteSpace(txtcard.Text) Or String.IsNullOrWhiteSpace(txtadmno.Text) Then
MessageBox.Show("Please complete the on the box.", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Dim Conn As System.Data.OleDb.OleDbConnection
Dim ConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"
Conn = New System.Data.OleDb.OleDbConnection(ConnectionString)
Try
If Conn.State = ConnectionState.Open Then Conn.Close()
Conn.Open()
Dim CMD As New System.Data.OleDb.OleDbCommand
CMD.CommandText = "Select FROM tbl_studentadm WHERE [Stud Admin] ='" & txtadmno.Text & "' AND [Admin Card] = '" & txtcard.Text & "'"
Dim sql As String = "insert into tbl_studentadm ([Stud Admin], [Admin Card]) values('" & txtadmno.Text & "', '" & txtcard.Text & "')"
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, Conn)
sqlCom.Connection = Conn
Dim result As Integer = sqlCom.ExecuteNonQuery()
sqlCom.Dispose()
Conn.Close()
If result > 0 Then
MessageBox.Show("Successfully Register.")
Else
MessageBox.Show("Failure to Register.")
End If
txtadmno.Text = ""
txtcard.Text = ""
txtadmno.Focus()
Lecturer_Form.Show()
Catch ex As Exception
MessageBox.Show("Failed to connect to Database..", "Database Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Student_Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
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")
Dim Result As Integer
Dim sql As String = "INSERT [Date Select] From tbl_studentadm values (@DateSelect) "
Dim cmd As New System.Data.OleDb.OleDbCommand(sql, conn)
Dim dtmNow As Date
cmd.Parameters.Add("@dateselect", OleDb.OleDbType.Date).Value = DTP.Value
conn.Open()
dtmNow = DateValue(Now)
Result = cmd.ExecuteNonQuery()
If Result > 0 Then
MessageBox.Show("Successfully.")
Else
MessageBox.Show("This date you did have it.")
End If
cmd.Parameters.Clear()
cmd.Dispose()
conn.Close()
End Using
'Catch ex As Exception
'MessageBox.Show("Failed to connect to Database..", "Database Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
'End Try
End Sub
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) VALUES ('" & txtadmno.Text & "', '" & txtcard.Text & "')"
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, conn)
sqlCom.Connection = conn
conn.Open()
Dim CMD As New System.Data.OleDb.OleDbCommand
CMD.CommandText = "Update(tbl_studentadm) SET([Stud Admin] = Values, another [Stud Admin] = WHERE TimeIN = TimeOutValues"
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
'Catch ex As Exception
'MessageBox.Show("Failed to connect to Database..", "Database Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
'End Try
End Sub