How To Use OleDb To Create Excel Database

前端 未结 4 1251
[愿得一人]
[愿得一人] 2020-12-18 16:49

My task is to take an Access Database and create an Excel file, but I can not seem to CREATE the Excel file that OleDb will use.

The Excel file name

4条回答
  •  囚心锁ツ
    2020-12-18 17:35

    I found a working solution, just remove IMEX parameter like this :

    string connString = String.Format(
        "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};" + 
        "Extended Properties=\"Excel 8.0;HDR={1}\"",
        file,
        (containsHeader ? "Yes" : "No")
    );
    

    When I tried Excel 12.0, it creates a file but I cannot open it in Excel Application.

    Anyway, this stuff works for XLS files.

提交回复
热议问题