2 Replies - 1839 Views - Last Post: 14 June 2013 - 07:58 PM Rate Topic: -----

#1 optix212  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 28
  • View blog
  • Posts: 516
  • Joined: 10-October 09

Excel - Could not find installable ISAM

Posted 14 June 2013 - 11:59 AM

I've been trying to get past this error for quite some time now..

What I want my program to do is to upload the contents of an excel spreadsheet onto a datagridview. I pretty much have the logic planned out right, but it's throwing an error whenever I try to import the file. The error reads "Could not find installable ISAM". I don't know exactly what this error means, so I have no idea how to fix it. I've been googling for hours now, and i still haven't found anything that would help me.

Here is the function for uploading a speadsheet:
        public void ExcelImport(string path, string queryTable, string fileName)
        {

            try
            {
                string query = "SELECT * FROM [" + queryTable + "$]";

                OleDbConnection conn = new OleDbConnection();

                conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=" + @"Excel 8.0;HDR=YES";
                OleDbDataAdapter adapter = new OleDbDataAdapter(query, conn);

                //DataSet dataSet = new DataSet();

                adapter.Fill(DTItems);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }

            
        }




and here is the code that is called when the Upload button is clicked:
        private void btnImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofImport = new OpenFileDialog();
            ofImport.Title = "Select file";
            ofImport.InitialDirectory = @"c:\";
            ofImport.Filter = "Excel 97(*.xls)|*.xls|Excel Sheet(*.xlsx)|*.xlsx|All Files(*.*)|*.*";
            ofImport.FilterIndex = 1;
            ofImport.RestoreDirectory = true;

            if (ofImport.ShowDialog() == DialogResult.OK)
            {
                string path = System.IO.Path.GetFullPath(ofImport.FileName);
                string name = ofImport.FileName;
                string table;
                if (tabControl1.SelectedTab == tabControl1.TabPages[0])
                {
                    table = "Accounts";
                    ExcelImport(path, table, name);
                }
                else if (tabControl1.SelectedTab == tabControl1.TabPages[1])
                {
                    table = "Tasks";
                    ExcelImport(path, table, name);
                }
                else if (tabControl1.SelectedTab == tabControl1.TabPages[2])
                {
                    table = "BankAccount";
                    ExcelImport(path, table, name);
                }
                else
                {
                    MessageBox.Show("Must have a database selected.");
                }
            }
            else
            {
                ofImport.Dispose();
            }   
        }
  


Is This A Good Question/Topic? 0
  • +

Replies To: Excel - Could not find installable ISAM

#2 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3741
  • View blog
  • Posts: 13,086
  • Joined: 12-December 12

Re: Excel - Could not find installable ISAM

Posted 14 June 2013 - 02:07 PM

Check the connection string at connectionstrings.com. For Excel 2007+ then it is Extended Properties="Excel 12.0 Xml".

8.0 is for .xls files. Here is the reference which refers to OLEDB 4.0, but further down it confirms the syntax to use (ACE) 12.0. That is, you have to alternate the Extended Properties, but can use (ACE) 12.0 in both cases.

If your sheet name contains spaces then you may need to embed apostrophes around this (again, I haven't checked). Get it working firstly with a sheet-name that doesn't contain spaces. Edited: A little research suggests that apostrophes are not necessary.

This post has been edited by andrewsw: 14 June 2013 - 02:18 PM

Was This Post Helpful? 0
  • +
  • -

#3 optix212  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 28
  • View blog
  • Posts: 516
  • Joined: 10-October 09

Re: Excel - Could not find installable ISAM

Posted 14 June 2013 - 07:58 PM

I am trying to upload Excel 97 .xls worksheets.. This is still messing with me..

I'm going to try using the odbc connection string.. Hopefully I can manage that way, I will keep you posted.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1