4

I am trying to read data from Excel file into my windows application.

Connection String :

provider = Microsoft.Jet.OLEDB.4.0; Data Source = "Excel File"; 
Extended Properties =    \"Excel 8.0; HDR = Yes; ImportMixedTypes = Text;
Imex = 1;\" 

With this connection string I am able to read data from Excel file even though Microsoft office - Excel is not installed onto the computer. But some how, my program is not compatible with this connection string.

Connection String which I am using right now is

provider = Microsoft.ACE.OLEDB.12.0; Data Source = "Excel file"; 
Extended Properties = "Excel 12.0; HDR = Yes; Imex = 1;

This connection string is compatible with my program but it only works on the computer which do have Microsoft office - Excel install.

Can anyone suggest me where I am making mistake.

Thanks.

4

2 に答える 2

5

Microsoft は、2003 年以降、64 ビット Windows 2003 を含むすべてのバージョンの Windows で JET エンジンを削除しました。ACE は最新の代替手段ですが、Windows の基本インストールでは配布されません。

ACE を使用するには、Microsoft から再配布可能な無料の ACE を、Office がインストールされていないすべてのターゲット マシンに展開する必要があります。次に、それらのいずれかでリストした 2 番目の接続文字列を使用できます。

Microsoft から入手してください: http://www.microsoft.com/en-us/download/details.aspx?id=13255

于 2012-06-12T21:32:04.727 に答える
0

サード パーティのライブラリを使用できる場合は、Linq を使用して Excel ファイルにアクセスできる、かなり優れたプロジェクトがあります。http://code.google.com/p/linqtoexcel/で確認してください。

于 2012-06-12T21:33:16.400 に答える