using ( OleDbConnection csvConnection = new OleDbConnection(("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+filename + ";Extended Properties=Text;"))) { using ( OleDbCommand csvCommand = new OleDbCommand("SELECT * FROM 01061102.csv", csvConnection)) { csvConnection.Open(); // Using a DataReader to process the data using (OleDbDataReader reader = csvCommand.ExecuteReader()) { while (reader.Read()) { // Process the current reader entry... } } // Using a DataTable to process the data using (OleDbDataAdapter adp = new OleDbDataAdapter(csvCommand)) { DataTable tbl = new DataTable("MyTable"); adp.Fill(tbl); foreach (DataRow row in tbl.Rows) { // Process the current row... } } } }
using System.IO; if(File.Exist(filename)) { ///put your code here } else { //invalid file path }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)