ASP connection to .xls

I am trying to insert excel data into an access database. The code below works perfectly for me even though it gives me access denied after successful upload.

<%
Set cn = CreateObject("ADODB.Connection")

'scn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\docs\dbto.mdb"

MM_NDC2016_STRING = " Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath("data/dbase.mdb")

cn.Open MM_NDC2016_STRING

sSQL = "INSERT INTO ElectionResults SELECT * FROM "
sSQL = sSQL & "[Excel 8.0;HDR=YES;IMEX=2;DATABASE=C:\inetpub\wwwroot\election\Data\ataupload.xls].[Sheet1$]"

cn.Execute sSQL, recs

MsgBox recs
%>

However, when i upload it online it does not work. I noticed is the connection from the Excel. I edited it to this way

<%
Set cn = Server.CreateObject("ADODB.Connection")

'scn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\docs\dbto.mdb"

MM_NDC2016_STRING = " Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath("data/dbase.mdb")

cn.Open MM_NDC2016_STRING

sSQL = "INSERT INTO ElectionResults SELECT * FROM "
sSQL = sSQL & " Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath("data/Dataupload.xls").[Sheet1$]

cn.Execute sSQL, recs

MsgBox recs
%>

and i get this error

Microsoft JET Database Engine error '80040e09'

Cannot update. Database or object is read-only.

/election/asp_upload.asp, line 33

I have given read/write permission to the database but still getting the same error

Can anyone help me out...

Thank you

0 answers