In this article i will tell you How to Delete record from access database using C#.Net.
In the Previous articles i explained How to solve password length minimum 7 non alphanumeric characters required 1, How to apply pagination in repeater control using asp.net, How to add my website to google, How to create connection string, how to insert record into access database using c#.net, how to update record into access database using c#.net and many more about C#.Net.
Use below namespace.
Write below code on click event of the button.
OleDbConnection con = new OleDbConnection("YourConnectionString");
OleDbCommand cmd = 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.