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. Database & SysAdmin
  3. Database
  4. Excel and OLE DB

Excel and OLE DB

Scheduled Pinned Locked Moved Database
databasecom
3 Posts 3 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.
  • S Offline
    S Offline
    Steven M Hunt
    wrote on last edited by
    #1

    Hello. I am working on a project which involves reading from and writing to an excel file. I'm having a few bugs at the moment. I can only get it to write if there is already data saved in the excel file. Second, after it does save the data, my attempt to re-read it only results in OLE stating that there is only one column of data, even though there is obviously 3. It works if i resave it in Excel, but that's not really a viable option as this program is supposed to automate things. If anyone has experience with OLE and has a solution or at least a suggestion for some of these problems, please post a response. Thanks in advance.

    -- Steven Hunt

    F R 2 Replies Last reply
    0
    • S Steven M Hunt

      Hello. I am working on a project which involves reading from and writing to an excel file. I'm having a few bugs at the moment. I can only get it to write if there is already data saved in the excel file. Second, after it does save the data, my attempt to re-read it only results in OLE stating that there is only one column of data, even though there is obviously 3. It works if i resave it in Excel, but that's not really a viable option as this program is supposed to automate things. If anyone has experience with OLE and has a solution or at least a suggestion for some of these problems, please post a response. Thanks in advance.

      -- Steven Hunt

      F Offline
      F Offline
      Frank Kerrigan
      wrote on last edited by
      #2

      Yes I've done this and you want to look on codeproduct for a free class that allows writing/reading of excel files.


      Blog Have I http:\\www.frankkerrigan.com

      1 Reply Last reply
      0
      • S Steven M Hunt

        Hello. I am working on a project which involves reading from and writing to an excel file. I'm having a few bugs at the moment. I can only get it to write if there is already data saved in the excel file. Second, after it does save the data, my attempt to re-read it only results in OLE stating that there is only one column of data, even though there is obviously 3. It works if i resave it in Excel, but that's not really a viable option as this program is supposed to automate things. If anyone has experience with OLE and has a solution or at least a suggestion for some of these problems, please post a response. Thanks in advance.

        -- Steven Hunt

        R Offline
        R Offline
        Rob Graham
        wrote on last edited by
        #3

        You can use ADO.net (or just plain ADO) and treat the excel sheet like a datbase table. Use the Jet Engine with an excel specific connection string and reference the appropriate sheet as $SheetName (sheet name prefixed with $). I have used Carlos Antonini's C++ ADO wrapper classes successfully with Excel in this way. ADO.Net with DataTables/DataReaders and SQL commands works as well.

        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