In this article i will tell you How to Delete record from access database using VB .Net.
In the Previous articles i explained how to insert record into access database using c#.net, how to update record into access database using c#.net, how to delete record from access database using c#.net, which namespace is used for membership class, how to insert record into access database using vb.net, how to update record into access database using vb.net and many more about VB.Net.
Use below namespace.
Write below code on click event of the button.
Dim con As New OleDbConnection("YourConnectionString")
Dim cmd As New OleDbCommand("Delete from table1 where name='Harish Sharma'", con)
lbl_msg.Text = "Record Deleted Successfully."
lbl_msg.Text = "Error Occured."
Below is the explanation.
Create connection with your database. Replace "YourConnectionString" with your own connection string.
Open Your Connection.
Create Sql command for Deleting records from table1. Here i am Deleting the records from table1 where name is "Harish Sharma". Also pass your connection in oledbcommand.
Show Message if record Deleted successfully.
Close the connection.