I want to make possible to the user download a file that is created each time
the user press de button. how can I do that?
I already ahe the following code, but it doesn't work properly:
<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="dump_action.asp">
<TABLE BORDER=0 CELLSPACING=8 CELLPADDING=8 WIDTH=100%>
<TR>
<TD ALIGN=CENTER VALIGN=CENTER>
<INPUT TYPE="Submit" NAME="Download" VALUE="Download...">
<INPUT TYPE="Hidden" NAME="exchid" VALUE="PTBVLP">
<INPUT TYPE="Hidden" NAME="quoteid" VALUE="PTBVLPPTC">
<INPUT TYPE="Hidden" NAME="dateto" VALUE="">
<INPUT TYPE="Hidden" NAME="datefrom" VALUE="">
</TD>
</TR>
</TABLE>
</FORM>
the dum_acton.asp file:
exchid = Request.Form ("exchid"
quoteid = Request.Form ("quoteid"
datefrom = Request.Form ("datefrom"
dateto = Request.Form ("dateto"
dump exchid, quoteid, datefrom, dateto
function dump (exchid,quoteid,datefrom,dateto)
sql = "SELECT "
if quoteid="" then
sql = sql & "i.QuoteId"
else
sql = sql & "CONCAT(i.ExchId, i.QuoteId)"
End if
sql = sql & ", q.dt, q.Open, q.High, q.Low, q.Close, q.Vol"
sql = sql & " FROM Quote q"
sql = sql & ", IDquote i"
if dateto<>"" then
sql = sql & " WHERE q.dt >= '" & datefrom & "' AND q.dt <= '" &
dateto
& "'"
else
sql = sql & "Where q.dt >= 0"
End if
sql = sql & " AND q.ExchId = '" & exchid & "'"
if instid <>"" then
sql = sql & " AND q.QuoteId = '" & QuoteId & "'"
End if
sql = sql & " ORDER BY 1, 2"
Response.Write sql
set conn = server.createobject ("ADODB.Connection"
conn.open "imdbconn"
set filequote = conn.execute(SQL)
filename = exchid & "-"
if QuoteId <>"" then
filename = filename & instid & "-"
End if
filename = filename & replace(datefrom,"-", "" & ".csv"
response.write "<TICKER>,<DTYYYYMMDD>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>"
while not filequote.eof
rec = ""
For i = 0 to file.count
rec = rec & filequote.item(i) & ","
Next 'i
response.write replace(rec, ",$", ""
file.movenext
wend
End Function
Does anyone can help me?
the user press de button. how can I do that?
I already ahe the following code, but it doesn't work properly:
<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="dump_action.asp">
<TABLE BORDER=0 CELLSPACING=8 CELLPADDING=8 WIDTH=100%>
<TR>
<TD ALIGN=CENTER VALIGN=CENTER>
<INPUT TYPE="Submit" NAME="Download" VALUE="Download...">
<INPUT TYPE="Hidden" NAME="exchid" VALUE="PTBVLP">
<INPUT TYPE="Hidden" NAME="quoteid" VALUE="PTBVLPPTC">
<INPUT TYPE="Hidden" NAME="dateto" VALUE="">
<INPUT TYPE="Hidden" NAME="datefrom" VALUE="">
</TD>
</TR>
</TABLE>
</FORM>
the dum_acton.asp file:
exchid = Request.Form ("exchid"
quoteid = Request.Form ("quoteid"
datefrom = Request.Form ("datefrom"
dateto = Request.Form ("dateto"
dump exchid, quoteid, datefrom, dateto
function dump (exchid,quoteid,datefrom,dateto)
sql = "SELECT "
if quoteid="" then
sql = sql & "i.QuoteId"
else
sql = sql & "CONCAT(i.ExchId, i.QuoteId)"
End if
sql = sql & ", q.dt, q.Open, q.High, q.Low, q.Close, q.Vol"
sql = sql & " FROM Quote q"
sql = sql & ", IDquote i"
if dateto<>"" then
sql = sql & " WHERE q.dt >= '" & datefrom & "' AND q.dt <= '" &
dateto
& "'"
else
sql = sql & "Where q.dt >= 0"
End if
sql = sql & " AND q.ExchId = '" & exchid & "'"
if instid <>"" then
sql = sql & " AND q.QuoteId = '" & QuoteId & "'"
End if
sql = sql & " ORDER BY 1, 2"
Response.Write sql
set conn = server.createobject ("ADODB.Connection"
conn.open "imdbconn"
set filequote = conn.execute(SQL)
filename = exchid & "-"
if QuoteId <>"" then
filename = filename & instid & "-"
End if
filename = filename & replace(datefrom,"-", "" & ".csv"
response.write "<TICKER>,<DTYYYYMMDD>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>"
while not filequote.eof
rec = ""
For i = 0 to file.count
rec = rec & filequote.item(i) & ","
Next 'i
response.write replace(rec, ",$", ""
file.movenext
wend
End Function
Does anyone can help me?