Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2018, 03:31 PM
Registered User
 
Join Date: Mar 2018
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default ASP Connection with .xls

I am trying to insert excel data into an access database. The code below works perfectly for me

<%
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\ele ction\Data\Dataupload.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'm getting this error

Microsoft VBScript runtime error '800a01a8'

Object required: '[string: "C:\inetpub\wwwroot\e"]'

/election/asp_upload.asp, line 21..

Can anyone help me out...

Thank you
The Following User Says Thank You to wisdeku For This Useful Post:





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to copy a.xls and b.xls to c.xls . honey26 Excel VBA 5 November 17th, 2011 12:34 PM
ASP: Reading xls without uploading on server kamrag Classic ASP Basics 0 September 25th, 2006 09:26 AM
download db data to .xls with asp abbylee26 Classic ASP Databases 2 October 17th, 2003 02:18 PM
ASP/XLS Format numbers lou_greally Classic ASP Professional 8 July 31st, 2003 03:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.