Results 1 to 3 of 3

Thread: [RESOLVED] OleDbDataReader from Excel gives blank line

  1. #1

    Thread Starter
    Fanatic Member Satal Keto's Avatar
    Join Date
    Dec 2005
    Location
    Me.Location
    Posts
    518

    Resolved [RESOLVED] OleDbDataReader from Excel gives blank line

    Hi,

    I am creating an application which uses OleDb to connect to an Excel spreadsheet and read the data into DataTable. The problem that I am having is that some of the columns I am getting are coming up blank, I've managed to narrow down that this is because that the first few lines for that column are blank.
    As unfortunately this is valid in the context of the Excel spreadsheet as not all dates etc. are required to be filled in.
    I was wondering whether anyone knows of any way that I could go about ensuring that the columns are populated by the OleDbDataReader even if the first x number of rows have that column as blank.

    Thanks for any help in advance.

    Satal

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: OleDbDataReader from Excel gives blank line

    Open RegEdit and navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel key. Create a value named TypeGuessRows of type DWORD if one doesn't already exist and set the value to 0. This will force the Jet OLEDB provider to test the value of every cell in a column to determine the column data type instead of the default 8. This will make reading the data slower but it also means that the wrong data type won't be used so values that don't match that data type won't be ignored.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width