ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

14-Removing User/s

Today, I’m going to teach you on how to remove the data in MySQL Database. Deleting or removing records is not required in a system but if you are a programmer you have to create this method when developing a system because you have to undergo in many testing and data entry into a database. This will be helpful to a programmer like you, to apply this function. I will add another function for clearing the text in the Textboxes.

 

 

Now, Let’s Begin:

 

 

Open the file of “EmployeesInformationSystem” that you had created. Drag two Buttons on the Form and name it “btnNew” and “btnDelete” . Set the Form just like this.
userregformdeleteform
After setting up the Form, double click the “New” Button to fire the click event handler of it and call the method for clearing the text in the TextBoxes that you had created.

  1. Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
  2. clearingObject(Me)
  3. End Sub

Go back to the “ManageUserForm” Form Design and double click the “Delete” Button to fire the click event handler of it. After that, add the following code for deleting and refreshing the records in the MySQL Database.

  1. Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
  2. query = "DELETE FROM `useraccounts` WHERE USER_ID='" & dtgList.CurrentRow.Cells(0).Value & "'"
  3. mysqlDelete(query)
  4.  
  5. 'RETRIEVING DATA
  6. 'STORE A SLECT QUERY IN A STRING VARIABLE
  7. query = "SELECT `USER_ID`, `UNAME` AS NAME, `USERNAME`, `TYPE` FROM `useraccounts` "
  8. 'SET A RETRIEVE METHOD THAT YOU HAD CREATED.
  9. mysqlRetrieve(query, dtgList)
  10. End Sub
Facebook Comments

Check Your Domain Ranking

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!