使用OLEDB讀取csv檔時

須指定UTF-8時須更改Connection String

String csvCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\ActiveDirectoryData\\receive;Extended Properties=\"Text;CharacterSet=65001;HDR=Yes;FORMAT=Delimited\"";

原先應是加入CharacterSet=UTF8;

如果你的系統不認識CharacterSet=UTF8; 則可試試看修改為CharacterSet=65001;

讀取時即會改成UTF8編碼!

arrow
arrow
    全站熱搜

    Kenny Lin 發表在 痞客邦 留言(0) 人氣()