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. Error in loading excel file in windows 7 ...

Error in loading excel file in windows 7 ...

Scheduled Pinned Locked Moved C#
helpdatabase
7 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.
  • N Offline
    N Offline
    nassimnastaran
    wrote on last edited by
    #1

    Hi all ! in my project to reading an excel file , there is no problem in windows XP , but in Win Seven(7) , I have problem to reading the excel 2007 file . here in some part of code :

    string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDlgData.FileName);
    string SheetName = "Test";
    string query = String.Format(@"select * from [{0}$]", SheetName);
    try
    {
    OleDbConnection conn = new OleDbConnection(connectionString);
    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, conn);
    System.Data.DataTable dt = new System.Data.DataTable("ExcelData");
    dataAdapter.Fill(dt);
    ...

    Thanks in any help !

    P L 3 Replies Last reply
    0
    • N nassimnastaran

      Hi all ! in my project to reading an excel file , there is no problem in windows XP , but in Win Seven(7) , I have problem to reading the excel 2007 file . here in some part of code :

      string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDlgData.FileName);
      string SheetName = "Test";
      string query = String.Format(@"select * from [{0}$]", SheetName);
      try
      {
      OleDbConnection conn = new OleDbConnection(connectionString);
      OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, conn);
      System.Data.DataTable dt = new System.Data.DataTable("ExcelData");
      dataAdapter.Fill(dt);
      ...

      Thanks in any help !

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      What problem do you have? That's the important part that's missing from your question.

      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

      N 1 Reply Last reply
      0
      • P Pete OHanlon

        What problem do you have? That's the important part that's missing from your question.

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

        N Offline
        N Offline
        nassimnastaran
        wrote on last edited by
        #3

        System.InvalidOpertionException:The 'Microsoft.ACE.OLEDB.12.0' provider

        1 Reply Last reply
        0
        • N nassimnastaran

          Hi all ! in my project to reading an excel file , there is no problem in windows XP , but in Win Seven(7) , I have problem to reading the excel 2007 file . here in some part of code :

          string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDlgData.FileName);
          string SheetName = "Test";
          string query = String.Format(@"select * from [{0}$]", SheetName);
          try
          {
          OleDbConnection conn = new OleDbConnection(connectionString);
          OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, conn);
          System.Data.DataTable dt = new System.Data.DataTable("ExcelData");
          dataAdapter.Fill(dt);
          ...

          Thanks in any help !

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          32 or 64 bit?

          Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012

          N 1 Reply Last reply
          0
          • L Lost User

            32 or 64 bit?

            Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012

            N Offline
            N Offline
            nassimnastaran
            wrote on last edited by
            #5

            64 bit

            L 1 Reply Last reply
            0
            • N nassimnastaran

              Hi all ! in my project to reading an excel file , there is no problem in windows XP , but in Win Seven(7) , I have problem to reading the excel 2007 file . here in some part of code :

              string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDlgData.FileName);
              string SheetName = "Test";
              string query = String.Format(@"select * from [{0}$]", SheetName);
              try
              {
              OleDbConnection conn = new OleDbConnection(connectionString);
              OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, conn);
              System.Data.DataTable dt = new System.Data.DataTable("ExcelData");
              dataAdapter.Fill(dt);
              ...

              Thanks in any help !

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              It's either not installed, or you're mixing environments. Read here[^].

              Bastard Programmer from Hell :suss:

              1 Reply Last reply
              0
              • N nassimnastaran

                64 bit

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                nassimnastaran wrote:

                64 bit

                That is probably your problem.

                Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012

                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