943,877 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 837
  • VB.NET RSS
Aug 13th, 2009
0

canot find a column

Expand Post »
VB.NET Syntax (Toggle Plain Text)
  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
VB.NET Syntax (Toggle Plain Text)
  1. cannot find column CustID
so i commented the first line of the drNewRow
thn i get the same error for the second line
VB.NET Syntax (Toggle Plain Text)
  1. cannot find column company
Similar Threads
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Aug 13th, 2009
0

Re: canot find a column

Where are you getting this DataTable from? Have you changed the routine you're using to get it?
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003
Aug 14th, 2009
0

Re: canot find a column

datatable is module level
and i have inserted data during the load event using data adapter which is also module level
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Aug 14th, 2009
0

Re: canot find a column

got it
the error was something entirely different
thnx for ur help
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Saving Drawing on PictureBox to SQL Database
Next Thread in VB.NET Forum Timeline: Disable MDI parent form button from MDI child form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC