C# Microsoft Jet database engine could not find the object ''

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DeelynBaNi
    New Member
    • Aug 2008
    • 7

    C# Microsoft Jet database engine could not find the object ''

    HI all..i have this excel file created during export data from sql server. When i try to import this error occured "external data is not in the correct format' something like that. After i did some research the extended properties need to be change to HTML Import from Excel 8.0. Then the connection is ok. I want to try to import the data from 'Sheet_1' to table in server but another error come up. The Microsoft Jet database engine could not find the object 'Sheet_1$'. Make sure the object exists and that you spell its name and the path name correctly. In my excel there is a sheet named Sheet_1.

    Code:
    OleDbConnection connection = new OleDbConnection(excelConnectionString);
    connection.Open();
    
    OleDbCommand command = new OleDbCommand("SELECT * FROM [Sheet_1$]", connection);
    
    OleDbDataReader dr = command.ExecuteReader(); <--error here
    How to solve this problem? Thanks in advance :)
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    That error seems to say that Sheet_1 doesn't exist. Perhaps the name of that sheet is different.

    Show your connection string (you can edit out sensitive data).

    Comment

    • DeelynBaNi
      New Member
      • Aug 2008
      • 7

      #3
      Originally posted by insertAlias
      That error seems to say that Sheet_1 doesn't exist. Perhaps the name of that sheet is different.

      Show your connection string (you can edit out sensitive data).
      My connection string:

      string excelConnection String = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" + source.Text + ";Extended Properties=\"HT ML Import;HDR=Yes; IMEX=1;\"";

      I've check many times and Sheet_1 exist and contain data to be import.

      Comment

      Working...