I have been searching for a couple of days for some code to help me add new rows to MS Access database. I found some useful code in this forum. I am trying to modify the code here to add many new records but I could not get it to work.
I really appreciate some help
I really appreciate some help
VB.NET:
Public Sub test4()
'Dim Connection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyDataBase.mdb")
Dim insertCommand As New OleDb.OleDbCommand("INSERT INTO StudentsTable (ID, Name) VALUES ('1','John')", Connection)
Try
Connection.Open()
MsgBox("Connection Opened")
insertCommand.ExecuteNonQuery()
MsgBox("The query has been executed")
Catch ex As Exception
MessageBox.Show(ex.ToString())
Finally
End Try
Connection.Close()
End Sub