Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

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 on Thursday, May 12, 2011 6:46 AM .Net Framework | Back to top


Comments on this post: Prevent Jet.OLEDB provider to converts strings to decimals

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net