Click here to Skip to main content
14,838,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
OleDbConnection DBConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/carrier411_header_example.csv") + ";Extended Properties='Text;HDR=Yes;'");

ERROR:
'D:\Anand\Projects\ExcelGV\carrier411_header_example.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.

But actually all the path was correct and I uploaded CSV file to read. Why it is unable to establish a connection to a csv file?
Posted
Updated 15-Oct-10 22:13pm
v2
Comments
Sandeep Mewara 16-Oct-10 4:13am
   
Use PRE tags to format code part. It makes your question readable.

Make sure you do have permissions to access this folder.
   
Try 2 things:
1. Make sure file exists at following path: 'D:\Anand\Projects\ExcelGV\carrier411_header_example.csv'

2. Make sure you have configured proper permissions such that your code can access the file. For simple testing, provide access to 'Everyone' and see how things go. If it works then you need to figure out the appropriate permission for your application based on other settings.
   
Solution:
A Fast CSV Reader
By Sebastien Lorion

Using ADO .NET JET provider is much slower and unstable --- it sometimes fails for no obvious reason. It's like a windows registry tweak is needed.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900