Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

public OleDbConnection OpenConnection(string FilePath)
 {
     string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + FilePath + "; Extended Properties='Excel 8.0; IMEX=1'";
     OleDbConnection con = new OleDbConnection(ConnectionString);
     con.Open();
     return con;
 }


the above function gives "External table is not in the expected format" error could anyone help me what is this about please ?

Thanks in advance
Posted

1 solution

have a look at this example

example
 
Share this answer
 
Comments
Jacobb Michael 31-Aug-10 5:04am    
Thank you for the Ref:

and
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";
OleDbConnection objConn = new OleDbConnection(connectionString);

this is the connection string used in that example it is similar to the connection string what i have created.

and still i get "External table is not in the expected format" error.
Simon_Whale 31-Aug-10 5:14am    
is this for any file tried? or just that file?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900