Prevent Jet.OLEDB provider to converts strings to decimals


I have an utility, that reads a CSV files into ADO.Net , modifies it and Saves as another .CSV file.
Unfortunately Microsoft.Jet.OLEDB provider corrupts some string column, incorrectly interpreting them as decimals.
Thanks to the article
I was able to specify schemaIni before reading the file using the function
 

public static void SaveSchemaIni(string path, string schemaIniContent)

{

FileInfo fileinfo = new FileInfo(path);

string dirPath =fileinfo.DirectoryName;

string schemaIniPath = dirPath + "\\schema.ini";

string sFileNameInIni=schemaIniContent.LeftBefore("]");

string newFileName = ("[" + fileinfo.Name + "]");// +Environment.NewLine

if(!String.IsNullOrEmpty(sFileNameInIni))

{

schemaIniContent=schemaIniContent.RightAfter("]");

}

schemaIniContent = newFileName + schemaIniContent;

StreamHelper.SaveStringToFile(schemaIniContent, schemaIniPath);

}
 
 
LeftBefore and RightAfter are string extensions from My StringHelper class
posted @ Thursday, May 12, 2011 6:46 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«May»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789