Here I will show how to Import data from csv file to sql database or any other database.
//This is the connection string to connect to your csv file
string strConString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\; Extended Properties=\”Text;HDR=YES;\””;
// open connection
OleDbConnection oCon = new OleDbConnection(strConString);
oCon.Open();
// fill data set
string strSql = “SELECT * FROM csvfile.csv”; //csvfile should be present in c:
OleDbDataAdapter [...]
Filed under: asp.net c#, csv, sql | Tagged: c#, csv, csv to sql, dot net, get csv, import csv file to database, import csv to sql, read csv file, sql | 6 Comments »


