Querying Excel Worksheet Problem

Last post 11-06-2009 10:41 AM by DarrellNorton. 1 replies.

Sort Posts:

  • Querying Excel Worksheet Problem

    11-06-2009, 10:09 AM
    • Member
      point Member
    • slackey26
    • Member since 11-06-2009, 2:50 PM
    • Posts 1

    I have a simple process that a user uploads and Excel file and I import that into an Oracle database.  The process works fine except when a column goes from text to numbers or vice versa.  If column 2 starts with characters and then switches to numbers, in the code the value goes to null when I get to the numbers. 

    Example:

    Col2

    ABC

    XYZ

    123

    In the code

    dr(1) value is

    ABC

    XYZ

    ""

    I'm using Excel 2002 and ASP.NET 3.5 with VB code behind.

  • Re: Querying Excel Worksheet Problem

    11-06-2009, 10:41 AM
    • All-Star
      54,795 point All-Star
    • DarrellNorton
    • Member since 04-04-2003, 11:49 AM
    • VA, USA
    • Posts 6,595
    • Moderator

    Excel guesses at your column type based on the first 8 rows, and thereafter if they don't look right it inserts null.

    See this article for several possible fixes:

    http://www.sqldts.com/254.aspx

    Darrell Norton, MVP
    Darrell Norton's Blog


    Please mark this post as answered if it helped you!
Page 1 of 1 (2 items)