Hi,
I have wriiten a code for importing excel to a sql table. But when I am running the page it is giving me the error as:-
An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
Please see the code for your reference:-
protected void Button1_Click(object sender, EventArgs e)
{
//Upload and save the file
string excelPath = Server.MapPath(FileUpload1.FileName);
FileUpload1.SaveAs(excelPath);
string conString = string.Empty;
string extension = Path.GetExtension(FileUpload1.PostedFile.FileName);
switch (extension)
{
case ".xls": //Excel 97-03
conString = ConfigurationManager.ConnectionStrings["DefaultSQLConnectionString"].ConnectionString;
break;
case ".xlsx": //Excel 07 or higher
...
Go to the complete details ...