Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'#########################
sub display_files()
'#########################
'open the file objects
set objfs = Server.CreateObject
("Scripting.FileSystemObject")
FolderPath=request.ServerVariables("APPL_PHYSICAL_PATH")
& "registrations/" 'specify filepath from root
set objfolder = objfs.GetFolder(FolderPath)
set objFiles = objFolder.Files
<html>
<body>
<table align="center" valign="top" width="100%" border="0">
<%if file <> "" then%>
<TR><TD>
<input type="button" value="Download current spreadsheet >>" name="download" onClick="javascript:window.open
('registrations/<%=file%>','registrations','toolbar=1,location=1,directories=1,menuB
ar=1,scrollbars=1,resizable=1,status=1,width=650,height=550,
left=10,top=10');">
<BR>[Filename: <%=file%>]</td></tR>
<%end if 'if file <> ""%>
<table border="1" bgcolor="#FFFFFF" cellspacing="0"
cellpadding="2" width="600">
<caption><B>Registration files</b></caption>
<TR>
<TH>Name</th>
<th>Size (kb)</th>
<th>Created</th>
</tr>
<%for each objFile in objFiles%>
<TR>
<TD><a href="reg_data/<%=objFile.Name%>" target="_blank"><%
=objFile.Name%></a></td>
<TD><%=objFile.Size%></td>
<TD><%=objFile.DateCreated%></td>
</tr>
<%next%>
</table>
</body>
</html>
'#########################
end sub 'display_files()
'#########################
'#########################
sub create_spreadsheet(file)
'#########################
'create the database connection
'(DB_CONNECTIONSTRING not included here)
set objconn=Server.CreateObject("ADODB.Connection")
objconn.open DB_CONNECTIONSTRING
set objrs=Server.CreateObject("ADODB.Recordset")
'get the data from the database you wish to display
SQL="SELECT * FROM tblregistrations WHERE IsNull
(cleared_flag) ORDER BY id asc"
set objrs=objconn.execute(SQL)
if not objrs.BOF and not objrs.EOF then
'base the spreadsheet name on the date (to keep it unique)
path=Server.mappath(".")
file=day(date)&month(date)&year(date)&"-"&hour(time)&minute
(time)&second(time)&"-registrations.xls"
range=day(date)&month(date)&year(date)&"registrations"
'create the file
set fso=CreateObject("scripting.filesystemobject")
set act=fso.CreateTextFile(server.mappath
("registrations/"&file),false)
'write the data to the spreadsheet
strline=""
For each x in objrs.Fields
strline=strline & x.Name & chr(9)
next
act.writeline strline
do while not objrs.EOF
strline=""
for each x in objrs.Fields
strline=strline & x.value & chr(9)
next
act.writeline strline
'loop thru
objrs.movenext
loop
'close the connections
act.close
end if 'if bof and eof
objrs.close
objconn.close
set objrs=nothing
set objconn = nothing
'##############################
end sub 'create_spreadsheet()
'##############################