Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Please do provide connection string for csv file in c#.net
Posted

 
Share this answer
 
Comments
Espen Harlinn 18-Jan-11 8:51am    
5+ Good link
string strFileName = "D://FXDEAL.csv";
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) +"; Extended Properties = \"Text;HDR=YES;FMT=Delimited\"");
conn.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM " + System.IO.Path.GetFileName(strFileName), conn);
DataSet ds = new DataSet("Temp");
adapter.Fill(ds);
DataTable tb = ds.Tables[0];
 
Share this answer
 
No effort from your side. For connection sting you can refer
this[^]

Hope this will help you :)
 
Share this answer
 

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