In this article i will tell you How to insert record into access database using VB.Net.
In the Previous articles i explained 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, how to delete record from access database using c#.net, which namespace is used for membership class 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("insert into table1(name,age,class)values('Harish Sharma','22','B.A Part 1')", con)
lbl_msg.Text = "Record inserted 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 inserting records. Here i am inserting the records into columns "name","age","class"of table "table1". Also pass your connection in oledbcommand.
Show Message if record inserted successfully.
Close the connection.