MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/visualbasic/comments/gn8qcr/urgent_saving_data_into_access_issue/fr8hetf
r/visualbasic • u/bouoron • May 20 '20
16 comments sorted by
View all comments
Show parent comments
3
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?
1
I've never used oledbcommanbuilders before, do you need to do an insert instead of an update?
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")