r/visualbasic • • May 20 '20

Urgent saving data into access issue

8 Upvotes

16 comments sorted by

View all comments

Show parent comments

3

u/bouoron May 20 '20

Dim cb As New OleDb.OleDbCommandBuilder(da)

Dim dsNewRow As DataRow

dsNewRow = ds.Tables("CustomerList").NewRow()

dsNewRow.Item(0) = txtCustomerID.Text

dsNewRow.Item(1) = txtCustomerName.Text

dsNewRow.Item(2) = cboGender.Text

dsNewRow.Item(3) = txtAddress.Text

dsNewRow.Item(4) = txtContactNumber.Text

ds.Tables("CustomerList").Rows.Add(dsNewRow)

da.Update(ds, "CustomerList")

totalrecords = totalrecords + 1

MsgBox("Registered")

1

u/RJohn12 May 20 '20

I've never used oledbcommanbuilders before, do you need to do an insert instead of an update?