I am trying to read a .Csv file in c#.net framework 4.0 and facing problem with connection string. First i tried this:
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;DataSource={0};ExtendedProperties='Excel 12.0 Xml;HDR=YES;IMEX=1;'"
but it shows the error:
External table is not in the expected format.
I think this can be only used for reading .xlsx file and i have tried this for reading .xlsx file and it is working.
Then i tried this:
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource={0};ExtendedProperties='text;HDR=Yes;FMT=Delimited'";
But it shows the error:
'F:\path\of the\file\filename.csv'is not a valid path.Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
Where i am doing mistake?
Thanks in advance.