Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with DataTable

Problem with DataTable

Scheduled Pinned Locked Moved C#
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    draco_iii
    wrote on last edited by
    #1

    I am using MySQLDriverCS and I have a table I have gotten through the select command. When I try the following foreach(DataRow myData in MyDataTable.Rows) { } I throws an InvalidCastException in System.Data.dll I have even tried sending the rows to a DataRowCollection and it does the same thing when doing the foreach loop. I have checked HasErrors property and it is false. This is not making much sence to me. Anyone have any ideas.

    M 1 Reply Last reply
    0
    • D draco_iii

      I am using MySQLDriverCS and I have a table I have gotten through the select command. When I try the following foreach(DataRow myData in MyDataTable.Rows) { } I throws an InvalidCastException in System.Data.dll I have even tried sending the rows to a DataRowCollection and it does the same thing when doing the foreach loop. I have checked HasErrors property and it is false. This is not making much sence to me. Anyone have any ideas.

      M Offline
      M Offline
      Meysam Mahfouzi
      wrote on last edited by
      #2

      What about this?

      for(int i=0; i<MyDataTable.Rows.Count; i++)
      {
      MyDataTable.Rows[i]. ...
      }


      Don't forget, that's

      Persian Gulf

      not Arabian gulf!


      Murphy:
      Click Here![^]

      Events and Delegates simplified:
      Click Here![^]


      I'm thirsty like sun, more landless than wind...


      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups