954,160 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

canot find a column

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
babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

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

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

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

babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

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

babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You