canot find a column

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2009
Posts: 132
Reputation: babbu has a little shameless behaviour in the past 
Solved Threads: 13
babbu babbu is offline Offline
Junior Poster

canot find a column

 
0
  #1
Aug 13th, 2009
  1. frmColourName.ShowDialog()
  2.  
  3. 'adding a customer
  4. m_Customercount = m_Customercount + 1
  5. Dim drNewRow As DataRow = m_CustomerDataTable.NewRow()
  6. drNewRow("CustID") = m_Customercount
  7. drNewRow("Company") = txtCompName.Text.Trim
  8. drNewRow("Address") = txtAddress.Text.Trim
  9. drNewRow("Telephone") = txtContact.Text.Trim
  10. drNewRow("Address") = txtAddress.Text.Trim
  11. drNewRow("Email") = btnEmail.Text.Trim
  12.  
  13. Dim counter As Integer = 0
  14. While counter < m_CustomerDataTable.Rows.Count
  15. If m_CustomerDataTable.Rows(counter)("Company") = txtCompName.Text.Trim Then
  16. MessageBox.Show("This company already exists")
  17. Exit Sub
  18. End If
  19. counter = counter + 1
  20. End While
  21.  
  22. m_CustomerDataTable.Rows.Add(drNewRow)
  23. m_CustomerDataAdapter.Update(m_CustomerDataTable)
  24. 'end of add
  25.  
  26. 'adding a colourcombination
  27. m_Colourcount = m_Colourcount + 1
  28. Dim drNewRow1 As DataRow = m_ColourDataTable.NewRow()
  29. drNewRow1("CID") = m_Colourcount
  30. drNewRow1("CustID") = m_Customercount
  31. drNewRow1("ColourName") = g_colourname
  32.  
  33. m_ColourDataTable.Rows.Add(drNewRow1)
  34. m_ColourDataAdapter.Update(m_ColourDataTable)
  35. 'end of add
  36.  
  37.  
  38. cboColourName.Enabled = True
  39. cboColourCode.Enabled = True
  40. lstColourName.Items.Add(g_colourname)
  41. lstColourName.SelectedItem = g_colourname
  42.  
  43.  
  44. txtCompName.Enabled = False
  45. txtAddress.Enabled = False
  46. txtContact.Enabled = False
  47. btnEmail.Enabled = False
  48.  
  49.  
  50. btnNewCombination.Enabled = False
  51. 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
  1. cannot find column CustID
so i commented the first line of the drNewRow
thn i get the same error for the second line
  1. cannot find column company
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: canot find a column

 
0
  #2
Aug 13th, 2009
Where are you getting this DataTable from? Have you changed the routine you're using to get it?
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 132
Reputation: babbu has a little shameless behaviour in the past 
Solved Threads: 13
babbu babbu is offline Offline
Junior Poster

Re: canot find a column

 
0
  #3
Aug 14th, 2009
datatable is module level
and i have inserted data during the load event using data adapter which is also module level
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 132
Reputation: babbu has a little shameless behaviour in the past 
Solved Threads: 13
babbu babbu is offline Offline
Junior Poster

Re: canot find a column

 
0
  #4
Aug 14th, 2009
got it
the error was something entirely different
thnx for ur help
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC