Updating Records to database

prashbs08

New member
Joined
May 20, 2014
Messages
2
Programming Experience
Beginner
Hi all,
I couldn't able to update the record to database (MS ACCESS). Below is the code. What might be wrong in the code.
HTML:
 Try
            con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DataBase.mdb;Persist Security Info=False")

            con.Open()
            Sql = "SELECT * FROM tblContacts"
            da = New OleDb.OleDbDataAdapter(Sql, con)
            da.Fill(ds, "datatable")

            dsNewRow = ds.Tables("datatable").NewRow()
            dsNewRow("Speed") = "078.8"
            dsNewRow("Displacement") = "099.5"
            dsNewRow("AxialForce") = "099.5"
            dsNewRow("FrictionalForce") = "099.5"
            ds.Tables("datatable").Rows.Add(dsNewRow)

            da.Update(ds, "datatable")

            con.Close()
            MsgBox("Updated Successfully")
        Catch ex As Exception
            MsgBox("Unable Update the Data")
        End Try
Thanks, Your help will be greatly appreciated.
 
Back
Top