.net - I'm trying to access Excel file to export it to SQL database with ASP.NET and VB.NET but getting following error -


the microsoft access database engine cannot open or write file ''. opened exclusively user, or need permission view , write data.

i'm trying import excel file asp.net , vb.net update sql server. i'm getting following error. please give me solution. vb.net code.

dim strconnection [string] = "projectlist"     dim path string = fileuploadexcel.postedfile.filename     dim excelconnectionstring string = "provider=microsoft.ace.oledb.12.0;data source=" & path & ";extended properties=excel 12.0;persist security info=false;mode= share deny none;persist security info=false;mode=12"     dim excelconnection new oledbconnection(excelconnectionstring)     dim cmd new oledbcommand("select [id],[name],[designation] [sheet1$]", excelconnection)     excelconnection.open()     dim dreader oledbdatareader     dreader = cmd.executereader()     dim sqlbulk new sqlbulkcopy(strconnection)     sqlbulk.destinationtablename = "excel_table"     sqlbulk.writetoserver(dreader)     excelconnection.close() 

web.config code

<connectionstrings>     <add name="projectlist" connectionstring="data source=(localdb)\v11.0;attachdbfilename=c:\users\pt-33\documents\visual studio 2013\websites\lt_v1\data\projects_list.mdf;integrated security=true;connect timeout=30"  providername="system.data.sqlclient" />   </connectionstrings> 

tried setting permissions folder i.e. network service permission not working.

this initial excel connection string

"provider=microsoft.ace.oledb.12.0;data source=" + path + ";extended properties=excel 12.0;persist security info=false" 

make sure have closed excel file. go task manager. check there microsoft office excel app or background process running. if yes, select , click on end task button.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -