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. Reading Numeric column in excel as text .

Reading Numeric column in excel as text .

Scheduled Pinned Locked Moved C#
csharpvisual-studio
3 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.
  • U Offline
    U Offline
    unitecsoft
    wrote on last edited by
    #1

    I am trying to read an Excel sheet to my program using OleDbDataAdapter into datatable , this is working fine except that if the excel column is text and taken into string field in the datatable its read as blank . anyone came across such a case . I am using ,NET 2.o framework with visual studio 2005 - C# . thankx

    U 1 Reply Last reply
    0
    • U unitecsoft

      I am trying to read an Excel sheet to my program using OleDbDataAdapter into datatable , this is working fine except that if the excel column is text and taken into string field in the datatable its read as blank . anyone came across such a case . I am using ,NET 2.o framework with visual studio 2005 - C# . thankx

      U Offline
      U Offline
      unitecsoft
      wrote on last edited by
      #2

      Actually , if the first data cell in the column is numeric , the full column is read as numeric and any text in the same column is read as blank . and if the first data cell is text then the full column is read as text and any numeric cell in the same column is read as blank . I have columns with mixed data , some numeric only and some are string . any hints ?

      A 1 Reply Last reply
      0
      • U unitecsoft

        Actually , if the first data cell in the column is numeric , the full column is read as numeric and any text in the same column is read as blank . and if the first data cell is text then the full column is read as text and any numeric cell in the same column is read as blank . I have columns with mixed data , some numeric only and some are string . any hints ?

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        In fact by default it ooks at the first 8 rows (odd number, really) and decides by that. Its a right pain, the last time I had this problem I ended up converting to csv and reading that.

        Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

        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