Click here to Skip to main content
15,170,528 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

   
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];
   
No effort from your side. For connection sting you can refer
this[^]

Hope this will help you :)
   

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