I am trying to add new row to the table
but i can't
error is object reference not set to an instance of an object
code:
VB Code:
Dim cust_det_ds As New DataSet Dim cust_det_da As New OleDb.OleDbDataAdapter If count_custdetails2 = 0 Then 'if the customer is not in cust_details2 table Dim cb1 As New OleDb.OleDbCommandBuilder(cust_det_da) Dim dsNewRow As DataRow dsNewRow = cust_det_ds.Tables("cust_details2").NewRow() dsNewRow.Item("Account_no") = txtCustNo.Text dsNewRow.Item("Title") = txtTitle.Text dsNewRow.Item("Initial") = txtInitial.Text dsNewRow.Item("Surname") = txtSurname.Text dsNewRow.Item("HouseName") = txtHname.Text dsNewRow.Item("Address1") = txtAdd1.Text dsNewRow.Item("Address2") = txtAdd2.Text dsNewRow.Item("Address3") = txtAdd3.Text dsNewRow.Item("Address4") = txtAdd4.Text dsNewRow.Item("Address5") = txtAdd5.Text dsNewRow.Item("Postcode") = txtPostcode.Text cust_det_ds.Tables("cust_details2").Rows.Add(dsNewRow) cust_det_da.Update(cust_det_ds, "cust_details2") Else End If
cust_det_ds.Tables("cust_details2").NewRow() error is in this line
Any idea?
thanks




Reply With Quote