I have been writing an implementation for reading a .csv data file into C# datatable and do some basic string manipulations.
It all works well until it meets the cell with mixed data type. for example, “40C”. Then it doesn’t even read, it just skips it.
I’ve been researching online on possible ways to solve this issue but it looks like there is no other way to do it.
I’ve read it somewhere that I would need to use SQL or Acess to make it work but then wouldn’t I run into the same problems when dealing with mixed data types?
Does any one know of a better way to solve this problem? I would really love to stay with .csv extension though.
P.S. I am not posting my code due to the fact that it works but not for mixed data types but if you would insist, I can post the code.
Thank you in advance!
Answering my own question:
Basically, I tried to use Schema.ini file but it still didn’t work.
Instead, I found a simpler solution. The problem was easily fixed by simply changing ImportMixedTypes setting to “Text” in RegEdit here: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines\Text on 64-bit machine or HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text on a 32-bit machine.