0
frmColourName.ShowDialog()

        'adding a customer
        m_Customercount = m_Customercount + 1
        Dim drNewRow As DataRow = m_CustomerDataTable.NewRow()
        drNewRow("CustID") = m_Customercount
        drNewRow("Company") = txtCompName.Text.Trim
        drNewRow("Address") = txtAddress.Text.Trim
        drNewRow("Telephone") = txtContact.Text.Trim
        drNewRow("Address") = txtAddress.Text.Trim
        drNewRow("Email") = btnEmail.Text.Trim

        Dim counter As Integer = 0
        While counter < m_CustomerDataTable.Rows.Count
            If m_CustomerDataTable.Rows(counter)("Company") = txtCompName.Text.Trim Then
                MessageBox.Show("This company already exists")
                Exit Sub
            End If
            counter = counter + 1
        End While

        m_CustomerDataTable.Rows.Add(drNewRow)
        m_CustomerDataAdapter.Update(m_CustomerDataTable)
        'end of add

        'adding a colourcombination
        m_Colourcount = m_Colourcount + 1
        Dim drNewRow1 As DataRow = m_ColourDataTable.NewRow()
        drNewRow1("CID") = m_Colourcount
        drNewRow1("CustID") = m_Customercount
        drNewRow1("ColourName") = g_colourname

        m_ColourDataTable.Rows.Add(drNewRow1)
        m_ColourDataAdapter.Update(m_ColourDataTable)
        'end of add


        cboColourName.Enabled = True
        cboColourCode.Enabled = True
        lstColourName.Items.Add(g_colourname)
        lstColourName.SelectedItem = g_colourname


        txtCompName.Enabled = False
        txtAddress.Enabled = False
        txtContact.Enabled = False
        btnEmail.Enabled = False


        btnNewCombination.Enabled = False
    End Sub

this was working fine for quite a while
but after i made some changes to the other part of the programs which do not seem to be related to this in any way i get this error msg

cannot find column CustID

so i commented the first line of the drNewRow
thn i get the same error for the second line

cannot find column company
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by babbu
0

Where are you getting this DataTable from? Have you changed the routine you're using to get it?

0

datatable is module level
and i have inserted data during the load event using data adapter which is also module level

0

got it
the error was something entirely different
thnx for ur help

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.