asp.net - cannot find installable isam even -


 string filepath = configurationmanager.appsettings["filepath"].tostring();             string filename = string.empty;             if (testupload.hasfile)             {                 try                 {                     string[] allowedfile = { ".xlsx" };                     string fileext = system.io.path.getextension(testupload.postedfile.filename);                     bool validfile = allowedfile.contains(fileext);                     if (!validfile)                     {                         page.clientscript.registerstartupscript(this.gettype(), "scripts", "<script>alert('upload excel file');</script>");                     }                     else                     {                         int filelen = testupload.postedfile.contentlength;                         if (filelen < 1048567)                         {                             filename = path.getfilename(server.mappath(testupload.filename));                             testupload.saveas(server.mappath(filepath) + filename);                             string filepath = server.mappath(filepath) + filename;                             oledbconnection xlcon = null;                             if (fileext == ".xlsx")                             {                                 xlcon = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source" + filepath + ";extended properties =\" excel 12.0 xml;hdr=no;imex=1;\"");                             }                             xlcon.open();                             datatable dt = xlcon.getoledbschematable(oledbschemaguid.tables, null);                             string xlsheetname = dt.rows[0]["table_name"].tostring();                             oledbcommand xlcmd = new oledbcommand(@"select * [" + xlsheetname + "]", xlcon);                             oledbdataadapter xladpt = new oledbdataadapter(xlcmd);                             dataset xlset = new dataset();                             xladpt.fill(xlset);                             page.clientscript.registerstartupscript(this.gettype(), "scripts", "<script>alert('file uploaded');</script>");                             xlcon.close();                             filedatagrid.datasource = xlset;                             filedatagrid.databind();                         }                         else                         {                             page.clientscript.registerstartupscript(this.gettype(), "scripts", "<script>alert('uploaded file size should not greater 1mb');</script>");                         }                     }                 }                 catch (exception exp)                 {                     page.clientscript.registerstartupscript(this.gettype(), "scripts", "<script>alert('" + exp.message + "');</script>");                 }             }             else             {                 page.clientscript.registerstartupscript(this.gettype(), "scripts", "<script>alert('select file upload');</script>");             } 

i using code import excel file gridview in asp.net,but giving exception "cannot find installable isam".i have checked many solutions microsoft forums didn't work.i use ms office 2016, visual studio 2015 enterprise. how resolve problem.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -