0% found this document useful (0 votes)
67 views2 pages

RD WR - Asp

This document contains code for uploading a file from a client to a server and saving it to the file system. It also contains code for connecting to an Excel spreadsheet via ADO, retrieving data from the spreadsheet, and outputting the data to an HTML table. The code handles the client-side form for selecting a file, instantiates an upload class on the server-side to save the file, connects to the Excel file using ADO, retrieves the data, outputs the column names and data to an HTML table, and closes the connections.

Uploaded by

partho143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views2 pages

RD WR - Asp

This document contains code for uploading a file from a client to a server and saving it to the file system. It also contains code for connecting to an Excel spreadsheet via ADO, retrieving data from the spreadsheet, and outputting the data to an HTML table. The code handles the client-side form for selecting a file, instantiates an upload class on the server-side to save the file, connects to the Excel file using ADO, retrieves the data, outputs the column names and data to an HTML table, and closes the connections.

Uploaded by

partho143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

<%@LANGUAGE="VBSCRIPT"%>

<% Option Explicit %>


<!--#include le="MyFiles/clsUpload.asp" -->
<html>
<body>
'Client Side:....
'-------------<form name="Upload" enctype="multipart/form-data" method="post" action="clsUpload.asp">
<div>Upload le: </div>
<div><INPUT TYPE="le" NAME="le" >
<input type="button" name="FileUpload" value="Upload File"> </div>
</form>

'Server Side:...
'---------------Dim objUpload
Dim strFile, strPath
' Instantiate Upload Class '
Set objUpload = New clsUpload
strFile = objUpload.Fields("le").FileName
strPath = server.mappath("/data") & "/" & strFile
' Save the binary data to the le system '
objUpload("le").SaveAs strPath
Set objUpload = Nothing

<%
Dim objConn, objRS, strSQL
Dim objConn2, objRS2, strSQL2
Dim x, curValue, y, arrMy, n, z
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; "&_
"Excel 8.0; DBQ=" & Server.MapPath("Academic_data.xls") & "; "
strSQL = "SELECT * FROM A2:Q10000"
Set objRS=objConn.Execute(strSQL)
'Set objConn2 = Server.CreateObject("ADODB.Connection")
'objConn2.Provider="Microsoft.Jet.OLEDB.4.0"
'objConn2.Open "C:\Inetpub\wwwroot\MGMA\dMGMA.mdb"
'Set objRS2 = Server.CreateObject("ADODB.recordset")
'strSQL2 = "SELECT * FROM tACADRAWDATA"
'objRS2.Open strSQL2, objConn2, 2 ,3
'objRS2.Addnew
Response.Write("<table border=""0"">")
Response.Write("<tr>")

le:///D|/Users/PPC032/Desktop/New%20folder/RD_WR.asp.txt[24-Feb-16 9:42:29 AM]

For x=1 To objRS.Fields.Count


Response.Write("<th>" & rsAdd.Fields(x).Name & "</th>")
Next
Response.Write("</tr>")
Do Until objRS.EOF
-Response.Write("</table>")
objConn.Close
Set objRS=Nothing
Set objConn=Nothing
%>
</body>
</html>
<%
rsAdd.Close()
Set rsAdd = Nothing
%>

le:///D|/Users/PPC032/Desktop/New%20folder/RD_WR.asp.txt[24-Feb-16 9:42:29 AM]

You might also like