Hi i have the following code.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New OleDbConnection
Dim da As New OleDbDataAdapter
Dim ds As New DataSet
Dim dsnewrow As DataRow
Dim cb As New OleDbCommandBuilder(da)
Dim a As String
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\DB.mdb;Jet OLEDB:Database Password=123"
con.Open()
a = "select * from Login"
da = New OleDbDataAdapter(a, con)
da.Fill(ds, "Login1")
dsnewrow = ds.Tables("Login1").NewRow()
ds.Tables("Login1").Rows.Add(dsnewrow)
dsnewrow.Item("Lid") = "test"
dsnewrow.Item("Name") = Uname2.Text.ToString()
dsnewrow.Item("Lps") = psw1.Text.ToString()
dsnewrow.Item("Acces1") = Acs.Text.ToString()
dsnewrow.Item("Date1") = DTp1.Value.ToString()
da.Update(ds, "Login1")
Uname2.Text = ""
psw1.Text = ""
Acs.Text = ""
DTp1.Value = Today()
con.Close()
I get the following error when i try to run the code and update in the MS access database Update requires a valid InsertCommand when passed DataRow collection with new rows.
Kindly help me on this issue.
Thanks