Hi,
I want to fill a GridView with csv file data. This is my code:
string csvFileName = "Jason.csv"; string pathWhereCSVFilesAre = @"Z:\path\";//Change this to your csv file path string conString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pathWhereCSVFilesAre + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\""; DataSet ds = new DataSet("MyDataSet"); OleDbDataAdapter adp = new OleDbDataAdapter(); using (OleDbConnection conn = new OleDbConnection(conString)) { using (OleDbCommand cmd = new OleDbCommand("SELECT * FROM " + csvFileName, conn)) { conn.Open(); adp.SelectCommand = cmd; adp.Fill(ds); } } GridView1.DataSource = ds;//Change ...

Go to the complete details ...