Could not find installable ISAM when Filling Adapter
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Could not find installable ISAM when Filling Adapter

  1. #1
    Join Date
    Mar 2012
    Posts
    7

    Could not find installable ISAM when Filling Adapter

    I am trying to get excel sheet data imported to a gridview. I am getting the error "Could not find installable ISAM" when the debugger reaches the ".Fill(dsSurvey);" portion of the code. I am using Windows XP, Office 2007, and the excel file is generated as a .xls file which is Excel 8.0. I have searched the web and installed drivers to try to fix this as microsoft advised but that does not fix it. I have been playing around with the connection string but I am not sure that is where the problem is since it occurs directly at the Fill. To test I tried commenting out the last two lines of the code and rerunning but I get no error so I assume the issue has something to do with the .Fill() line alone and nothing else but I cannot be sure. My code is below:
    Code:
    public void ImportExcelSh()
            {
                GrdVwSurvey.Visible = true;
    
                OleDbConnection conn = new OleDbConnection();
                conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + flePath + SLASH + fleName + ";" + "Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0;";
    
                OleDbCommand command = new OleDbCommand
                    (
                        "SELECT PROBLEM ID, DateClosed, Full Name, RESPONSIBLE GROUP, CONTACT EMPLOYEE ID, CONTACT LAST NAME, CONTACT FIRST NAME, CONTACT EMAIL ADDRESS"+
                        "FROM [DAS Survey$]", conn
                    );
    
                DataSet dsSurvey = new DataSet();
                OleDbDataAdapter surveyAdapter = new OleDbDataAdapter(command);
                surveyAdapter.Fill(dsSurvey);
    
                GrdVwSurvey.DataSource = dsSurvey.Tables[0];
            }
    Last edited by Cimperiali; March 21st, 2012 at 05:32 PM. Reason: adding [code][/code] tags

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,247

    Re: Could not find installable ISAM when Filling Adapter

    Quote Originally Posted by Mcamp View Post
    I have been playing around with the connection string but I am not sure that is where the problem is since it occurs directly at the Fill.
    The problem is most likely the connection string (even though the issue doesn't surface until the Fill method).

    Search bing or google for '"Could not find installable ISAM" Office 2007 Excel 8.0 OleDbConnection C#'.

    There's plenty of help on the subject.

  3. #3
    Join Date
    Mar 2012
    Posts
    7

    Smile Re: Could not find installable ISAM when Filling Adapter

    I already did search google and seen all the info. I also tried a ton of what I found so I have tried Jet 4.0 and ACE 12.0. I have tried changing the syntax as per some of those on google. I have tried installing the driver which was suggested on one forum. I have tried changing excel from 8.0 to 12.0 as other pointed out. I have tried playing with Syntax doing countless things including ensuring spacing is right in the connection string. That is actually what led me to my final opinion that it must be something to do with the Adapter Fill().

    Then I also contacted a buddy of mines and I shared my desktop so he could see it also. We both messed around with it then and still the same error. This is actually my last resort to try forums, and usually when I am posting to a forum it means I have already tried googling (with all kinds of keyword combinations including the one you posted).

    Believe me when I tell you I would not waste my time on a forum for something that I can find in google since that is sooooooooooooooo much shorter and an easier solution

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Could not find installable ISAM when Filling Adapter

    ***edit - sorry, I saw now you said xp thus you are on a x32 machine
    the following does not apply

    you might have an issue related to 32 vs 64 bit software.
    Are you on a 64 machine?
    If yes, have you installed the x64 drivers?
    If yes, are you compiling fro AnyCpu? if yes to first, but you have the x32
    drivers, are you compiling x86?
    Last edited by Cimperiali; March 21st, 2012 at 05:32 PM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Could not find installable ISAM when Filling Adapter

    Ok, lets first give a bit of credit to Arjay and take a second to try to escape the connection string correctly.
    Look at this example (note the @ the ' and the ":
    Code:
     string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\TheFolder\TheExcelFile.xlsx;Extended Properties='Excel 12.0 Xml;HDR=YES;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0;';";
    as you already spent a lot on this, for the firs try, simply hardcode the path\filename.xlsx in that (without doubling the \ as the @ will escape it for you) and try. Should it work, you know it is an "escape" matter...Should not it, you can always come here and say bad words on me.
    Last edited by Cimperiali; March 21st, 2012 at 05:33 PM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  6. #6
    Join Date
    Mar 2012
    Posts
    7

    Re: Could not find installable ISAM when Filling Adapter

    Quote Originally Posted by Cimperiali View Post
    Ok, lets first give a bit of credit to Arjay and take a second to try to escape the connection string correctly.
    Look at this example (note the @ the ' and the ":
    Code:
     string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\TheFolder\TheExcelFile.xlsx;Extended Properties='Excel 12.0 Xml;HDR=YES;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0;';";
    as you already spent a lot on this, for the firs try, simply hardcode the path\filename.xlsx in that (without doubling the \ as the @ will escape it for you) and try. Should it work, you know it is an "escape" matter...Should not it, you can always come here and say bad words on me.
    Hello Cimperiali thanks for the advice I will try this. I believe I already tried it that way when I first started, but at this point I have no problem with trying again I may have been tired since I was working on it for a while last night. Anyway i'll let you know.

  7. #7
    Join Date
    Mar 2012
    Posts
    7

    Re: Could not find installable ISAM when Filling Adapter

    Okay this did not work, however it is not all bad what you gave me was a great test idea which has allowed me to locate the true problem of the connection string. So thanks a lot. So I decided I would hard code the path and see what happens. It worked when I put it back again to the variables for some reason visual studio gave a new error on the fill which gave away the source of the connection string problems. Somehow it is appending c: to whatever value is picked in the open file dialog box. HAHAHAHA now I see. Thanks for the vision. I will try fixing that because I cannot hard code this since the file is never in the same place.

  8. #8
    Join Date
    Mar 2012
    Posts
    7

    Re: Could not find installable ISAM when Filling Adapter

    Sweet I got it!! There were two problems. My Select statement needed brackets around the column names for some reason. The second error was that somehow it getting a C: in front of the whole path name so it might read something like this C:\F:\Filename. LOL. Wow 2 days just to find out it was my stupid formatting. Anyway thanks again Arjay and Cimperiali I really appreciate the advice and leads. Sorry Arjay if my comment seemed at all rude, I was not trying to be just a bit stressed after dealing with that for a couple days, I am sure you have been there.

  9. #9
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Could not find installable ISAM when Filling Adapter

    Quote Originally Posted by Mcamp View Post
    [...]My Select statement needed brackets around the column names for some reason. The second error was that somehow it getting a C: in front of the whole path name so it might read something like this C:\F:\Filename. LOL. Wow 2 days just to find out it was my stupid formatting. Anyway thanks again Arjay and Cimperiali I really appreciate the advice and leads. Sorry Arjay if my comment seemed at all rude, I was not trying to be just a bit stressed after dealing with that for a couple days, I am sure you have been there.
    brackets are usually needed when columns names are not well formed (for eaxmple, the are of two words with a space between) or could lead to a confusion (for example you give to a column the name of a reserved word, like "Connection"). Brakets make it clear to the sql engine that you're speaking of a column.
    About your path
    "Data Source=" + flePath + SLASH + fleName
    may we know how flePath is filled?
    usually you should do something like
    Code:
    string spathName=System.IO.Path.Combine(flePath,fleName);
    and then use spathName.
    To see where it is going while testing :
    Code:
    System.Diagnostic.Debug.Writeline(spathName);
    About Arjay : he is the one who solved this. I simply found a way to make you try once again on connection string formattting. You should rate Arjay
    Last edited by Cimperiali; March 22nd, 2012 at 02:37 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center