04-Register New Employee

This tutorial is all about Register New Employee.
In this tutorial, I will teach you how to create an Employee’s Registration Form. With this, you can register new Employee and you will determine the date the hired, their position, daily rate, working status and their pay method.

 

So, Let’s Begin:

Open the file “EmployeesInformationSystem” that you have created. After that, set up the Form just like this.
employeesregform
After creating an Employee’s Registration Form, double click the “Save” Button to fire the click event handler of it. And do this code in the method for saving data in the database.
[vbnet]
Private Sub btnempsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnempsave.Click
‘DECLARING A STRING VARIABLE
Dim gender As String
‘CHECKING IF THE RADIO BUTTON WAS CHECKED OR NOT
If rdomale.Checked = True Then
gender = “Male”
Else
gender = “Female”
End If
‘SET A QUERY FOR INSERTING DATA IN THE EMPLOYEES TABLE.
query = “insert into `employees` ” & _
“(`EMPLOYEE_ID`, `FIRST_NAME`, `LAST_NAME`, `MIDDLE_NAME`, `ADDRESS`, `PHONE_NUMBER`, `STATUS`, `BIRTH_DATE`,” & _
“`BIRTH_PLACE`, `GENDER`, `AGE`, `EMERG_CONTACT`)” & _
” VALUES ” & _
“(‘” & txtempId.Text & “‘,'” & txtfname.Text & “‘,'” & txtlname.Text & “‘,'” & txtmname.Text & _
“‘,'” & txtaddress.Text & “‘,'” & txtcontact.Text & “‘,'” & txtstatus.Text & “‘,'” & Format(dtpdbirth.Value, “yyyy-MM-dd”) & _
“‘,'” & txtbplace.Text & “‘,'” & gender & “‘,'” & txtage.Text & “‘,'” & txtemerg.Text & “‘)”
‘CALL THE METHOD THAT YOU HAVE CREATED
mysqlCUDNoMessage(query)
‘SET A QUERY FOR INSERTING DATA IN THE EMPLOYEES WORK INFORMATION TABLE.
query = “insert into `employeesworkinfo` (`EMPLOYEE_ID`, `D_RATE`,`POSITION`, `P_METHOD`, `W_STATUS`, `D_HIRED`)” & _
” values ” & _
” (‘” & txtempId.Text & “‘,'” & txtdrate.Text & “‘,'” & txtposition.Text & “‘,'” & txtpmethod.Text & “‘,'” & txtworkstatus.Text & _
“‘,'” & Format(dtpdhired.Value, “yyyy-MM-dd”) & “‘)”
‘CALL THE METHOD THAT YOU HAVE CREATED
mysqlCreate(query)
End Sub
[/vbnet]

 

Readers might read also:

 

2 thoughts on “04-Register New Employee”

Leave a Comment