Download DRW Results (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


phfdfp -> Download DRW Results (6/30/2008 22:27:51)

I would like to give users the option of downloading filtered DRW results into a CSV file...... thoughts on how to do this...

All comments appreciated....

Jim




DesiMcK -> RE: Download DRW Results (7/1/2008 17:12:14)

I use this:

<%
Dim DSN, RS, SQL, Conn


DSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("../targets.mdb")

SQL = "ENTER SQL HERE"


set Conn=server.createobject("adodb.connection")
Conn.open DSN
Set RS = Conn.Execute (SQL)

Dim F, Head
For Each F In RS.Fields
Head = Head & ", " & F.Name
Next
Head = Mid(Head,3) & vbCrLf
Response.Addheader "Content-Disposition", "inline; filename=myExportName.csv"
Response.ContentType = "application/download"
Response.Write Head
Response.Write RS.GetString(,,", ",vbCrLf,"")
Set RS = nothing
Conn.close
%>

Desi




phfdfp -> RE: Download DRW Results (7/3/2008 0:28:30)

outstanding!!! it works thanks.... but wait theres more...

i need to have it filtered like the form it comes from and i would like to DL only certain fields from the DB....

when i leave the selct from results where ........ it does not work... If i remove where..... it works but i get the whole file

Any more magic??

Thanks




DesiMcK -> RE: Download DRW Results (7/3/2008 12:22:00)

Can you post the SQL from your DRW please.




phfdfp -> RE: Download DRW Results (7/3/2008 17:58:55)

sure thanks

from the labels page

fp_sQry="SELECT * FROM Results WHERE (services_provided LIKE '%::services_provided::%')"
fp_sDefault="services_provided="
fp_sNoRecords="No records returned."
fp_sDataConn="associate_members"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&Key=3&Company_Name=202&Address=202&Choice=2&contact_name_last=202&contact_name_first=202&city=202&state=202&zip=202&level=202&phone=202&fax=202&contact_email=202&services_provided=202&other_remarks=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&web_site=202&other_remarks1=203&greatest_benefit=203&add_fasd=203&more_education=202&sponsor_ed=202&provide_spealers=202&"
fp_iDisplayCols=7
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>



from the dl page

<%
Dim DSN, RS, SQL, Conn


DSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("../fpdb/associate_members.mdb")

SQL = "SELECT * FROM Results "

set Conn=server.createobject("adodb.connection")
Conn.open DSN
Set RS = Conn.Execute (SQL)

Dim F, Head
For Each F In RS.Fields
Head = Head & ", " & F.Name
Next
Head = Mid(Head,3) & vbCrLf
Response.Addheader "Content-Disposition", "inline; filename=myExportName.csv"
Response.ContentType = "application/download"
Response.Write Head
Response.Write RS.GetString(,,", ",vbCrLf,"")
Set RS = nothing
Conn.close
%>





phfdfp -> RE: Download DRW Results (7/3/2008 17:59:24)

THANKS for looking!!!




DesiMcK -> RE: Download DRW Results (7/3/2008 18:08:22)

Try this - I am assuming that the user clicks on a link to export to csv.

On the first page put a link in:-

<a href="downloadCSV.asp?Services=<%=Request("services_provided")%>Click to download CSV</a>

on csv code page use this SQL:

SQL = "SELECT * FROM Results WHERE (services_provided LIKE '%" & Request("Services") & "')"




phfdfp -> RE: Download DRW Results (7/7/2008 22:51:59)

i am using a button with the properties post and submit.

I put in the suggested code and changed the sql on the download page..

it works but still downloads all records????

Any other ideas????

Thanks




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875