开发者

OleDb - big problems reading CSV file

I have to parse csv (txt extension) file. It is delimited with ',' and has all values in "".

First problem. If file has name like this firstpart.secondpart.txt executing the reader throws exception saying that Microsoft Jet engine couldn't find table (or sth like that - I have polish WinXp). When I remove "secondpart" from file name and leave it firstpart.txt I can execute the reader.

Second problem. reader.FieldCount returns 1. If I change separator to ';' it returns good number of fields. I've read that it is setting in registry which defines the separator for OleDb. In my registry it is ';' so that's why it works when I change it in file. I've also read that I can ovveride it using (FMR=Delimited(x)) in connection stirng. But that doesn't work. Third way supposed to be creating schema.ini file with Fo开发者_JAVA技巧rmat=Delimited(x) but it also doesn't work. Looks like registry setting is always used. Of course I can't change this setting on every target computer.

Can anybody help me please?

3P


I found the JET CSV reading functionality difficult to use, and now use this open source CSV reader instead.

It is fast/efficient and easy to use.


This may help: Speed up insert mdb

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜