Hi I have the following bit of code:
And I cant for the life of me work out why I get a:
error on row:
The goal is to simply add a new row to a Access2003 database file.
Thanks in advance.
VB.NET:
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("DeliveryNotes").NewRow
dsNewRow.Item("id") = "1"
dsNewRow.Item("date") = txtRef.Text
dsNewRow.Item("ref") = txtRef.Text
dsNewRow.Item("driver") = txtDriver.Text
dsNewRow.Item("vehicle") = txtVehicle.Text
dsNewRow.Item("customer") = txtCustomer.Text
dsNewRow.Item("acnumber") = txtACNum.Text
dsNewRow.Item("charge") = txtCharge.Text
dsNewRow.Item("contractno1") = txtContractNo1.Text
dsNewRow.Item("collect_details") = txtCollect_details.Text
dsNewRow.Item("contractno2") = txtContractNo2.Text
dsNewRow.Item("deliver_details") = txtDeliver_details.Text
dsNewRow.Item("goods_details") = txtGoods_details.Text
dsNewRow.Item("meter_reading") = txtMeter_reading.Text
dsNewRow.Item("serial_numbers") = txtSerial_Numbers.Text
ds.Tables("DeliveryNotes").Rows.Add(dsNewRow)
da.Update(ds, "DeliveryNotes")
MsgBox("New Record added to the Database")
And I cant for the life of me work out why I get a:
VB.NET:
Object reference not set to an instance of an object.
error on row:
VB.NET:
dsNewRow = ds.Tables("DeliveryNotes").NewRow
The goal is to simply add a new row to a Access2003 database file.
Thanks in advance.