I use the ConnectionString below to read data from excel files.
It succss with some excel files, but fail with others.
I think the excel file have different versions.

How can I make a general connection string which can read Excel for
defferent versions?



------------------------------------------------------------------------------------
string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data
Source=" + sExcelFile +
"; Extended Properties=" +
(char)34 + "Excel 8.0;IMEX=1;" + (char)34;

Re: The Connection string to Excel by Paul

Paul
Mon May 08 08:53:42 CDT 2006

On Sun, 7 May 2006 21:21:34 +0800, "ad" <flying@wfes.tcc.edu.tw> wrote:

¤ I use the ConnectionString below to read data from excel files.
¤ It succss with some excel files, but fail with others.
¤ I think the excel file have different versions.
¤
¤ How can I make a general connection string which can read Excel for
¤ defferent versions?
¤
¤
¤
¤ ------------------------------------------------------------------------------------
¤ string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data
¤ Source=" + sExcelFile +
¤ "; Extended Properties=" +
¤ (char)34 + "Excel 8.0;IMEX=1;" + (char)34;


The connection string should work with any version of Excel. What sort of error message is generated
when the connection fails?


Paul
~~~~
Microsoft MVP (Visual Basic)