ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

04-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.

  1. Private Sub btnempsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnempsave.Click
  2. 'DECLARING A STRING VARIABLE
  3. Dim gender As String
  4. 'CHECKING IF THE RADIO BUTTON WAS CHECKED OR NOT
  5. If rdomale.Checked = True Then
  6. gender = "Male"
  7. Else
  8. gender = "Female"
  9. End If
  10. 'SET A QUERY FOR INSERTING DATA IN THE EMPLOYEES TABLE.
  11. query = "insert into `employees` " & _
  12. "(`EMPLOYEE_ID`, `FIRST_NAME`, `LAST_NAME`, `MIDDLE_NAME`, `ADDRESS`, `PHONE_NUMBER`, `STATUS`, `BIRTH_DATE`," & _
  13. "`BIRTH_PLACE`, `GENDER`, `AGE`, `EMERG_CONTACT`)" & _
  14. " VALUES " & _
  15. "('" & txtempId.Text & "','" & txtfname.Text & "','" & txtlname.Text & "','" & txtmname.Text & _
  16. "','" & txtaddress.Text & "','" & txtcontact.Text & "','" & txtstatus.Text & "','" & Format(dtpdbirth.Value, "yyyy-MM-dd") & _
  17. "','" & txtbplace.Text & "','" & gender & "','" & txtage.Text & "','" & txtemerg.Text & "')"
  18. 'CALL THE METHOD THAT YOU HAVE CREATED
  19. mysqlCUDNoMessage(query)
  20. 'SET A QUERY FOR INSERTING DATA IN THE EMPLOYEES WORK INFORMATION TABLE.
  21. query = "insert into `employeesworkinfo` (`EMPLOYEE_ID`, `D_RATE`,`POSITION`, `P_METHOD`, `W_STATUS`, `D_HIRED`)" & _
  22. " values " & _
  23. " ('" & txtempId.Text & "','" & txtdrate.Text & "','" & txtposition.Text & "','" & txtpmethod.Text & "','" & txtworkstatus.Text & _
  24. "','" & Format(dtpdhired.Value, "yyyy-MM-dd") & "')"
  25. 'CALL THE METHOD THAT YOU HAVE CREATED
  26. mysqlCreate(query)
  27. End Sub
Facebook Comments

Check Your Domain Ranking

1 Comment

Add a Comment
  1. Thank you for any other excellent post. The place else may just anybody get that type of info in such an ideal method of writing? I’ve a presentation next week, and I’m on the search for such information.

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!