Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

marabozu

Status
Not open for further replies.

marabozu

Programmer
Jan 3, 2001
36
US
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=&quot;multipart/form-data&quot; METHOD=&quot;POST&quot; ACTION=&quot;dump_action.asp&quot;>
<TABLE BORDER=0 CELLSPACING=8 CELLPADDING=8 WIDTH=100%>
<TR>
<TD ALIGN=CENTER VALIGN=CENTER>
<INPUT TYPE=&quot;Submit&quot; NAME=&quot;Download&quot; VALUE=&quot;Download...&quot;>
<INPUT TYPE=&quot;Hidden&quot; NAME=&quot;exchid&quot; VALUE=&quot;PTBVLP&quot;>
<INPUT TYPE=&quot;Hidden&quot; NAME=&quot;quoteid&quot; VALUE=&quot;PTBVLPPTC&quot;>
<INPUT TYPE=&quot;Hidden&quot; NAME=&quot;dateto&quot; VALUE=&quot;&quot;>
<INPUT TYPE=&quot;Hidden&quot; NAME=&quot;datefrom&quot; VALUE=&quot;&quot;>
</TD>
</TR>
</TABLE>
</FORM>
the dum_acton.asp file:
exchid = Request.Form (&quot;exchid&quot;)
quoteid = Request.Form (&quot;quoteid&quot;)
datefrom = Request.Form (&quot;datefrom&quot;)
dateto = Request.Form (&quot;dateto&quot;)
dump exchid, quoteid, datefrom, dateto

function dump (exchid,quoteid,datefrom,dateto)
sql = &quot;SELECT &quot;
if quoteid=&quot;&quot; then
sql = sql &amp; &quot;i.QuoteId&quot;
else
sql = sql &amp; &quot;CONCAT(i.ExchId, i.QuoteId)&quot;
End if
sql = sql &amp; &quot;, q.dt, q.Open, q.High, q.Low, q.Close, q.Vol&quot;
sql = sql &amp; &quot; FROM Quote q&quot;
sql = sql &amp; &quot;, IDquote i&quot;
if dateto<>&quot;&quot; then
sql = sql &amp; &quot; WHERE q.dt >= '&quot; &amp; datefrom &amp; &quot;' AND q.dt <= '&quot; &amp;
dateto
&amp; &quot;'&quot;
else
sql = sql &amp; &quot;Where q.dt >= 0&quot;
End if
sql = sql &amp; &quot; AND q.ExchId = '&quot; &amp; exchid &amp; &quot;'&quot;
if instid <>&quot;&quot; then
sql = sql &amp; &quot; AND q.QuoteId = '&quot; &amp; QuoteId &amp; &quot;'&quot;
End if
sql = sql &amp; &quot; ORDER BY 1, 2&quot;
Response.Write sql
set conn = server.createobject (&quot;ADODB.Connection&quot;)
conn.open &quot;imdbconn&quot;
set filequote = conn.execute(SQL)
filename = exchid &amp; &quot;-&quot;
if QuoteId <>&quot;&quot; then
filename = filename &amp; instid &amp; &quot;-&quot;
End if
filename = filename &amp; replace(datefrom,&quot;-&quot;, &quot;&quot;) &amp; &quot;.csv&quot;
response.write &quot;<TICKER>,<DTYYYYMMDD>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>&quot;

while not filequote.eof
rec = &quot;&quot;
For i = 0 to file.count
rec = rec &amp; filequote.item(i) &amp; &quot;,&quot;
Next 'i
response.write replace(rec, &quot;,$&quot;, &quot;&quot;)
file.movenext
wend
End Function

Does anyone can help me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top