I am trying to do simple insert, update, delete, select statements within VB .NET to access a MS Access database. I have tried all kinds of solutions offered on the web and while the code seems to work, no rows are inserted. Also, I have tried, unsuccessfully, to use the Try/Catch to see if there's an error with no success. Please advise what I'm doing wrong. I have attached the versions of VB .Net and MS Access I am using:
Here's the code:
Dim Connection_String As String
Connection_String = "Provider=Microsoft.Jet.OLEDB.4.0;Password=;Data Source=C:\AquaticPT\AquaticPT.mdb"
Dim dbConn As OleDbConnection = New OleDbConnection(Connection_String)
Dim dbCMD As OleDbCommand
Dim dr As OleDbDataReader
Dim ds As DataSet = New DataSet
Dim cmdstr As String
Dim sqlQRY As String = "SELECT * FROM tbPatient"
Dim daAdapt As OleDbDataAdapter = New OleDbDataAdapter(sqlQRY, dbConn)
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(daAdapt)
dbConn.Open()
MsgBox("db open")
daAdapt.Fill(ds, "tbPatient")
Dim dt As DataTable = ds.Tables("tbPatient")
Dim dsNewRow As DataRow = dt.NewRow
dsNewRow("PrimaryPhone") = stPrimaryPhone
dsNewRow("FirstName") = stFirstName
dt.Rows.Add(dsNewRow)