Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 19th, 2018, 03:31 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 11:34 AM
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



All times are GMT -4. The time now is 07:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.