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 October 12th, 2006, 12:24 AM
Authorized User
 
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP - Excel to Database

Hello All,

Can someone help me with this problem?

I have 3 colums in an excel sheet (Serial No, Name, Mobile no), I want to put all the data in the excel sheet into the database which also has 3 colums (Serial No, Name, Mobile no) with a single click of a button using ASP.

Can someone code me this?


I have included both the access database and the excel file within the rapidshare link.


http://rapidshare.de/files/36425129/..._info.zip.html


Many thanx in advance :)

www.chargertek.in - Cheapest WebHosting
__________________
-----------------------------------------------
www.chargertek.in - Cheapest WebHosting
 
Old October 12th, 2006, 07:23 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This should work for you.

http://p2p.wrox.com/topic.asp?TOPIC_ID=25073

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old October 12th, 2006, 07:38 AM
Authorized User
 
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx for the link but I still could not make it work. May be I am too dumb for this


Any help will be appreciated


Thanx

www.chargertek.in - Cheapest WebHosting
 
Old October 12th, 2006, 07:47 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I am not going to transfer the excel file into the MDB for you if that is what you are hoping for.

http://support.microsoft.com/kb/195951/EN-US/
http://www.tek-tips.com/faqs.cfm?fid=3802
http://www.codeguru.com/forum/archiv.../t-182983.html

The last link is a .NET link but you get the idea. Once you have a recordset that contains your excel data all you have to do is insert it into the access database...

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old March 18th, 2007, 11:07 PM
Registered User
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Just wanted to ask for some help regarding the following piece of code, I'm trying to read from the excel file and update the data into and access database. Reading from excel file works fine and I can display it on the web in HTML but when I try to update the recordset in the access database, the data gets updated to the access but it gives me an error.
Following is the error and the code, I would really appreciate if you can help me with this.
ERROR:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/mgma/loadxls.asp, line 58

CODE:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
Dim rsAdd
Dim rsAdd_numRows

Set rsAdd = Server.CreateObject("ADODB.Recordset")
rsAdd.ActiveConnection = MM_mgma_STRING
rsAdd.Source = "SELECT * FROM tRDATA"
'rsAdd.CursorType = 2
rsAdd.CursorLocation = 2
rsAdd.LockType = 3
rsAdd.Open()
'rsAdd.AddNew

rsAdd_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<%
Dim objConn, objRS, strSQL
Dim x, curValue, y

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; "&_
    "Excel 8.0; DBQ=" & Server.MapPath("EXCEL_REPORTS\2003_04_05_Phy_Comp. xls") & "; "
strSQL = "SELECT * FROM A1:Q10000"
Set objRS=objConn.Execute(strSQL)
%>
<table border="0">
    <tr>
    <%
    For x=0 To objRS.Fields.Count-1
       Response.Write("<th>" & objRS.Fields(x).Name & "</th>")
    Next
    Do Until objRS.EOF
        'rsAdd.MoveFirst
        Response.Write("<tr>")
        For x=0 To objRS.Fields.Count-1
            curValue = objRS.Fields(x).Value
            If IsNull(curValue) Then
                curValue=" "
            End If
            curValue = CStr(curValue)
            y = y &","& curValue
            Response.Write("<td>" & curValue & "</td>")
        Next
        Response.Write("</tr>")
        arrMy = split(y, ",")
'+++++++++++++++++++
        rsAdd.AddNew
        For x=1 to rsAdd.Fields.Count-1
            rsAdd.Fields(x).value=arrMy(x)
        next
        rsAdd.Update
'+++++++++++++++++++
        objRS.MoveNext
        y = " "
    Loop
    %>
    </tr>
</table>
</body>

</html>
<%
rsAdd.Close
Set rsAdd = Nothing
%>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Impoting Excel file into Access Database using ASP prasanta2expert ASP.NET 1.0 and 1.1 Professional 0 October 5th, 2006 02:39 AM
ASP to Excel - excel output formatting issue mat41 Classic ASP Professional 0 August 13th, 2006 06:41 AM
Asp.net upload Excel Column to Database Patrick19 VB.NET 0 April 18th, 2005 02:56 AM
Uploading an Excel to Database using ASP anandham Classic ASP Databases 1 February 23rd, 2005 04:29 AM
Connecting to Excel Database with ASP thehaz Classic ASP Databases 2 March 24th, 2004 05:00 PM





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