dirklance
asked on
download recordset (in CSV)
Greetings experts,
i'm trying to give my users the opportunity to download a report (the returned recordset) in csv format.
I'm using the following header code, which works great in firefox (auto download to desktop) however in ie6 it just hangs. I need it to throw up a alert asking the user where they would like to save the file. Is this possible using the method i've chose?
FileName = "sampleReportName.txt"
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
thanks,
Briston
i'm trying to give my users the opportunity to download a report (the returned recordset) in csv format.
I'm using the following header code, which works great in firefox (auto download to desktop) however in ie6 it just hangs. I need it to throw up a alert asking the user where they would like to save the file. Is this possible using the method i've chose?
FileName = "sampleReportName.txt"
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
thanks,
Briston
ASKER
it sure does.
ASKER
I might also add i'm using it in an IFRAME if that makes any diff.
>>I might also add i'm using it in an IFRAME if that makes any diff.
Hmmm...not sure. I don't use IFRAME unless absolutely have to...so never tried it.
You'll have to post the rest of your code...doesn't appear to be a problem with the header.
Hmmm...not sure. I don't use IFRAME unless absolutely have to...so never tried it.
You'll have to post the rest of your code...doesn't appear to be a problem with the header.
And, also try this:
Response.clear '<-------------ADD
FileName = "sampleReportName.txt"
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
Response.clear '<-------------ADD
FileName = "sampleReportName.txt"
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
Or, could try other ways:
https://www.experts-exchange.com/questions/21288109/creating-a-csv-file-in-asp.html
https://www.experts-exchange.com/questions/21288109/creating-a-csv-file-in-asp.html
ASKER
here is the page that outputs the CSV file:
-------------------------- ---------- ------
<%response.buffer = true%>
<!-- METADATA TYPE="typelib" FILE="C:\program files\common files\system\ado\msado15.d ll" //-->
<!-- #include file="Includes/settings.as p" //-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title></title>
<META NAME="Author" CONTENT="?">
<meta http-equiv="Expires" content="Sun, 1 Jan 1995 08:00:00 CST">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="Includes/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
FileName = "sampleReportName.txt"
SQL = replace(replace(request("q "),"?","'" ),"-P-","% ")
Set objConn = Server.CreateObject("ADODB .Connectio n")
objConn.Open "Driver={MySQL ODBC 3.51 Driver}; Server=XX; Port=XX; Database=XX; User=bdavidge; Password=XXX; Option=3;"
Set RS = Server.CreateObject("ADODB .RecordSet ")
RS.Open SQL, objConn
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
For fnum = 0 To RS.Fields.Count-1
Response.Write """" & RS.Fields(fnum).Name & ""","
Next
RS.movefirst
Do Until RS.EOF
For fnum = 0 To RS.Fields.Count-1
' again, one of the ADODB.Field properties is Value, so...
Response.Write """" & RS.Fields(fnum).Value & ""","
Next
' response.write "<br />"
RS.MoveNext
Loop
RS.Close
objConn.Close
%>
</body>
</html>
-------------------------- ---------- ------
page csv.asp is wrapped in:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<head>
<title></title>
<META NAME="Author" CONTENT="?">
<meta http-equiv="Expires" content="Sun, 1 Jan 1995 08:00:00 CST">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var enablepersist="off" //Enable saving state of content structure? (on/off)
if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcon tent{displ ay:none;}' )
document.write('</style>')
}
function getElementbyClass(classnam e){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagN ame("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==cla ssname)
ccollect[inc++]=alltags[i]
}
}
function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.displa y="none"
inc++
}
}
function expandcontent(cid){
if (typeof ccollect!="undefined"){
contractcontent(cid)
document.getElementById(ci d).style.d isplay=(do cument.get ElementByI d(cid).sty le.display !="block") ? "block" : "none"
selectedItem=cid+"|"+docum ent.getEle mentById(c id).style. display
}
}
function revivecontent(){
selectedItem=getselectedIt em()
selectedComponents=selecte dItem.spli t("|")
contractcontent(selectedCo mponents[0 ])
document.getElementById(se lectedComp onents[0]) .style.dis play=selec tedCompone nts[1]
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(se arch)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf("; ", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(docum ent.cookie .substring (offset, end))
}
}
return returnvalue;
}
function getselectedItem(){
if (get_cookie(window.locatio n.pathname ) != ""){
selectedItem=get_cookie(wi ndow.locat ion.pathna me)
return selectedItem
}
else
return ""
}
function saveswitchstate(){
if (typeof selectedItem!="undefined")
document.cookie=window.loc ation.path name+"="+s electedIte m
}
function do_onload(){
getElementbyClass("switchc ontent")
if (enablepersist=="on" && getselectedItem()!="")
revivecontent()
}
if (window.addEventListener)
window.addEventListener("l oad", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload ", do_onload)
else if (document.getElementById)
window.onload=do_onload
if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitch state
</script>
<link href="Includes/backend_sty le.css" rel="stylesheet" type="text/css">
</head>
<body class="bodyWrapper">
<table cellpadding="0" cellspacing="0" style="width:100%;height:1 00%;">
<tr>
<td colspan="4" style="background-color:#4 a7385;widt h:100%;hei ght:63px;b order-bott om:2px solid #999999;"><div style="padding-left:15px;" ><img src="Images/logo_topper.jp g" /></div></td>
</tr>
<tr valign="top">
<td colspan="3" style="height:25px;">  ;</td>
<td style="background-color:#f 6f6f6;bord er-left:1p x solid #e7e7e7;"> </td>
</tr>
<tr valign="top">
<td style="width:5px;"><img src="Images/1x1_trans.gif" width="12" height="1" /></td>
<td style="width:220px">
<!-- CONTENT //-->
<table cellpadding="0" cellspacing="0">
<tr valign="middle">
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div class="expBoxesWrapper" onClick="expandcontent('sc 1')"><img src="Images/arrow_4a7385.j pg" /> <b>CONTENT</b></div></td>
</tr>
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div id="sc1" class="switchcontent" style="padding-left:10px;" ><img src="Images/dottedLine.jpg " /><br /><br />
<span><span class="lNavHeader">MAIN*PA C</span><b r /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="pages.asp?org=MAINPA C&mode=lis t" class="lNav" target="content">Main Pages</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="custom.asp?mode=list &org=MAINP AC" class="lNav" target="content">Custom Pages</a><br /><br /><span class="lNavHeader">MAIN*st ream</span ><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="pages.asp?org=MAINST REAM&mode= list" class="lNav" target="content">Main Pages</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="custom.asp?mode=list &org=MAINS TREAM" class="lNav" target="content">Custom Pages</a><br /><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="custom.asp?org=SHARE D&mode=lis t" class="lNav" target="content">Shared Custom Pages</a><br /><br /></span></div></td>
</tr>
<tr>
<td><div style="background:url('Ima ges/btm.jp g');backgr ound-repea t:no-repea t;width:20 0px;height :26px;padd ing-left:1 0px;paddin g-top:10px ;"> < /div></td>
</tr>
</table><br />
<!-- REPORTS //-->
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div class="expBoxesWrapper" onClick="expandcontent('sc 2')"><img src="Images/arrow_4a7385.j pg" /> <b>REPORTS</b></div></td>
</tr>
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div id="sc2" class="switchcontent" style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;width:200 px;padding -left:10px ;"><img src="Images/dottedLine.jpg " /><br /><br />
<span><span class="lNavHeader">Members </span><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="qMaster_members.asp" class="lNav" target="content">Run QueryMaster</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="members.asp" class="lNav" target="content">View All</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="q.asp?t=members&mode =LIST" class="lNav" target="content">Saved Queries</a><br /><br />
<span class="lNavHeader">Donatio ns</span>< br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="qMaster_donations.as p" class="lNav" target="content">Run QueryMaster</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="donations.asp" class="lNav" target="content">View All</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="donate_chooseOrg.asp " class="lNav" target="content">Add a Donation</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="q.asp?t=donations&mo de=LIST" class="lNav" target="content">Saved Queries</a><br /><br />
<span class="lNavHeader">Site Stats</span><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="stats.asp" class="lNav" target="content">View Stats</a><br /></span></div></td>
</tr>
<tr>
<td><div style="background:url('Ima ges/btm.jp g');backgr ound-repea t:no-repea t;width:20 0px;height :26px;padd ing-left:1 0px;paddin g-top:10px ;"> < /div></td>
</tr>
</table><br />
<!-- MEMBERSHIP MAINT. //-->
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div class="expBoxesWrapper" onClick="expandcontent('sc 3')"><img src="Images/arrow_4a7385.j pg" /> <b>MEMBERSHIP MAINT.</b></div></td>
</tr>
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div id="sc3" class="switchcontent" style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;width:200 px;padding -left:10px ;"><img src="Images/dottedLine.jpg " /><br /><br />
<span> <img src="Images/arrow_small_gr ay.jpg" /> <a href="qMaster_members.asp? fMode=1&q= SELECT%20* %20FROM%20 members%20 WHERE%20me mberStatus %20=%20?in active?&m= Choose_the _member_yo u_would_li ke_to_acti vate_and_c lick_the_a ctivate_bu tton" class="lNav" target="content">Inactive Members</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="addMember.asp" class="lNav" target="content">Add a Member</a><br /></span></div></td>
</tr>
<tr>
<td><div style="background:url('Ima ges/btm.jp g');backgr ound-repea t:no-repea t;width:20 0px;height :26px;padd ing-left:1 0px;paddin g-top:10px ;"> < /div></td>
</tr>
</table><br />
<!-- SETTINGS //-->
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div class="expBoxesWrapper" onClick="expandcontent('sc 4')"><img src="Images/arrow_4a7385.j pg" /> <b>SETTINGS</b></div></td>
</tr>
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div id="sc4" class="switchcontent" style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;width:200 px;padding -left:10px ;"><img src="Images/dottedLine.jpg " /><br /><br />
<span><span class="lNavHeader">Merchan t Acct.</span><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="merchantAcct.asp" class="lNav" target="content">Merchant Acct Login</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="http://linkpoint.com/platformstatus/plat_main.htm" class="lNav" target="content">Linkpoint Status</a></span></div></t d>
</tr>
<tr>
<td><div style="background:url('Ima ges/btm.jp g');backgr ound-repea t:no-repea t;width:20 0px;height :26px;padd ing-left:1 0px;paddin g-top:10px ;"> < /div></td>
</tr>
</table><br />
<!-- HELP //-->
<table cellpadding="0" cellspacing="0">
<tr valign="middle">
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div class="expBoxesWrapper" onClick="expandcontent('sc 5')"><img src="Images/arrow_4a7385.j pg" /> <b>HELP</b></div></td>
</tr>
<tr>
<td style="background:url('Ima ges/rep.jp g');backgr ound-repea t:repeat-y ;"><div id="sc5" class="switchcontent" style="padding-left:10px;" ><img src="Images/dottedLine.jpg " /><br /><br />
<span> <img src="Images/arrow_small_gr ay.jpg" /> <a href="faq.asp" class="lNav" target="content">FAQ</a><b r /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="help.asp?mode=editor " class="lNav" target="content">Editor Help</a><br /> <img src="Images/arrow_small_gr ay.jpg" /> <a href="http://luminopolis.com/supportTicket" class="lNav" target="content">Submit a support ticket</a></span></div></t d>
</tr>
<tr>
<td><div style="background:url('Ima ges/btm.jp g');backgr ound-repea t:no-repea t;width:20 0px;height :26px;padd ing-left:1 0px;paddin g-top:10px ;"> < /div></td>
</tr>
</table>
</td>
<!-- right hand side table //-->
<td style="width:585px;">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima ges/bigRep .jpg');bac kground-re peat:repea t-y;"><div style="background:url('Ima ges/bigTop .jpg');bac kground-re peat:no-re peat;width :574px;hei ght:13px;p adding-lef t:10px;pad ding-top:1 0px;">&nbs p;</div></ td>
</tr>
<tr>
<td style="background:url('Ima ges/bigRep .jpg');bac kground-re peat:repea t-y;text-a lign:cente r;height:9 9%;"><div style="width:569px;padding -left:3px; "><iframe frameborder="0" name="content" id="content" style="width:98%;height:65 0px;backgr ound-color :#ffffff;" src="welcome.htm">Your browser needs to support frames to use this application</iframe></div> </td>
</tr>
<tr>
<td><div style="background:url('Ima ges/bigBtm .jpg');bac kground-re peat:no-re peat;width :574px;hei ght:39px;p adding-lef t:10px;pad ding-top:1 0px;">&nbs p;</div></ td>
</tr>
</table>
</td>
<td style="background-color:#f 6f6f6;bord er-left:1p x solid #e7e7e7;height:100%;width: 100%;">&nb sp;</td>
</tr>
<tr valign="top">
<td colspan="3" style="height:45px;">  ;</td>
<td style="background-color:#f 6f6f6;bord er-left:1p x solid #e7e7e7;"> </td>
</tr>
</table>
</body>
</html>
__________________________ ____--
points raised.
thanks,
--------------------------
<%response.buffer = true%>
<!-- METADATA TYPE="typelib" FILE="C:\program files\common files\system\ado\msado15.d
<!-- #include file="Includes/settings.as
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title></title>
<META NAME="Author" CONTENT="?">
<meta http-equiv="Expires" content="Sun, 1 Jan 1995 08:00:00 CST">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="Includes/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
FileName = "sampleReportName.txt"
SQL = replace(replace(request("q
Set objConn = Server.CreateObject("ADODB
objConn.Open "Driver={MySQL ODBC 3.51 Driver}; Server=XX; Port=XX; Database=XX; User=bdavidge; Password=XXX; Option=3;"
Set RS = Server.CreateObject("ADODB
RS.Open SQL, objConn
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
For fnum = 0 To RS.Fields.Count-1
Response.Write """" & RS.Fields(fnum).Name & ""","
Next
RS.movefirst
Do Until RS.EOF
For fnum = 0 To RS.Fields.Count-1
' again, one of the ADODB.Field properties is Value, so...
Response.Write """" & RS.Fields(fnum).Value & ""","
Next
' response.write "<br />"
RS.MoveNext
Loop
RS.Close
objConn.Close
%>
</body>
</html>
--------------------------
page csv.asp is wrapped in:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<head>
<title></title>
<META NAME="Author" CONTENT="?">
<meta http-equiv="Expires" content="Sun, 1 Jan 1995 08:00:00 CST">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var enablepersist="off" //Enable saving state of content structure? (on/off)
if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcon
document.write('</style>')
}
function getElementbyClass(classnam
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagN
for (i=0; i<alltags.length; i++){
if (alltags[i].className==cla
ccollect[inc++]=alltags[i]
}
}
function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.displa
inc++
}
}
function expandcontent(cid){
if (typeof ccollect!="undefined"){
contractcontent(cid)
document.getElementById(ci
selectedItem=cid+"|"+docum
}
}
function revivecontent(){
selectedItem=getselectedIt
selectedComponents=selecte
contractcontent(selectedCo
document.getElementById(se
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(se
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";
if (end == -1) end = document.cookie.length;
returnvalue=unescape(docum
}
}
return returnvalue;
}
function getselectedItem(){
if (get_cookie(window.locatio
selectedItem=get_cookie(wi
return selectedItem
}
else
return ""
}
function saveswitchstate(){
if (typeof selectedItem!="undefined")
document.cookie=window.loc
}
function do_onload(){
getElementbyClass("switchc
if (enablepersist=="on" && getselectedItem()!="")
revivecontent()
}
if (window.addEventListener)
window.addEventListener("l
else if (window.attachEvent)
window.attachEvent("onload
else if (document.getElementById)
window.onload=do_onload
if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitch
</script>
<link href="Includes/backend_sty
</head>
<body class="bodyWrapper">
<table cellpadding="0" cellspacing="0" style="width:100%;height:1
<tr>
<td colspan="4" style="background-color:#4
</tr>
<tr valign="top">
<td colspan="3" style="height:25px;"> 
<td style="background-color:#f
</tr>
<tr valign="top">
<td style="width:5px;"><img src="Images/1x1_trans.gif"
<td style="width:220px">
<!-- CONTENT //-->
<table cellpadding="0" cellspacing="0">
<tr valign="middle">
<td style="background:url('Ima
</tr>
<tr>
<td style="background:url('Ima
<span><span class="lNavHeader">MAIN*PA
</tr>
<tr>
<td><div style="background:url('Ima
</tr>
</table><br />
<!-- REPORTS //-->
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima
</tr>
<tr>
<td style="background:url('Ima
<span><span class="lNavHeader">Members
<span class="lNavHeader">Donatio
<span class="lNavHeader">Site Stats</span><br /> <img src="Images/arrow_small_gr
</tr>
<tr>
<td><div style="background:url('Ima
</tr>
</table><br />
<!-- MEMBERSHIP MAINT. //-->
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima
</tr>
<tr>
<td style="background:url('Ima
<span> <img src="Images/arrow_small_gr
</tr>
<tr>
<td><div style="background:url('Ima
</tr>
</table><br />
<!-- SETTINGS //-->
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima
</tr>
<tr>
<td style="background:url('Ima
<span><span class="lNavHeader">Merchan
</tr>
<tr>
<td><div style="background:url('Ima
</tr>
</table><br />
<!-- HELP //-->
<table cellpadding="0" cellspacing="0">
<tr valign="middle">
<td style="background:url('Ima
</tr>
<tr>
<td style="background:url('Ima
<span> <img src="Images/arrow_small_gr
</tr>
<tr>
<td><div style="background:url('Ima
</tr>
</table>
</td>
<!-- right hand side table //-->
<td style="width:585px;">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="background:url('Ima
</tr>
<tr>
<td style="background:url('Ima
</tr>
<tr>
<td><div style="background:url('Ima
</tr>
</table>
</td>
<td style="background-color:#f
</tr>
<tr valign="top">
<td colspan="3" style="height:45px;"> 
<td style="background-color:#f
</tr>
</table>
</body>
</html>
__________________________
points raised.
thanks,
There shouldn't be any HTML in a CSV file...you should only have VBScript t create the page.
ASKER
originally i had no html in the csv with the same results.
Go to Windows Explorer -->Tools Menu-->Folder Options-->File Types tab-->Choose CSV from the list and highlight-->click Advanced button -->Highlight Open-->Check the check box that says Confirm Open after download
ASKER
My settings are already as you describe.
thanks,
thanks,
And still does not ask for Open, Save ?
ASKER
it sure doesn't in ie.
it does in FF though.
it does in FF though.
Take off Response.buffer and try
ASKER
in order to use response.clear i have to set the buffer to true.
when i take out the buffer and response.clear it just writes the csv info to the page.
http://mainstreamcoalition.org/ADMIN/expand.asp
click on reports
click on query master
run a query like WHERE memberID is > 300
when i take out the buffer and response.clear it just writes the csv info to the page.
http://mainstreamcoalition.org/ADMIN/expand.asp
click on reports
click on query master
run a query like WHERE memberID is > 300
Boss,
I am getting a RS error. See this
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/ADMIN/csv.asp, line 21
You are passing wrong/incorrect value and RS can't find anything
When you click on download CSV
I am getting a RS error. See this
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/ADMIN/csv.asp, line 21
You are passing wrong/incorrect value and RS can't find anything
When you click on download CSV
Sorry hit submit before full post
I said When you click on download CSV R Click to Open in a new window. Your SQL parsing is wrong
SELECT * FROM `donations` WHERE `memberID` > 100 ORDER BY `dID` asc
Why single quotes around donations, member id, dID etc ?
I said When you click on download CSV R Click to Open in a new window. Your SQL parsing is wrong
SELECT * FROM `donations` WHERE `memberID` > 100 ORDER BY `dID` asc
Why single quotes around donations, member id, dID etc ?
ASKER
those are to escape keywords.
i'm not sure what the symbol is called but they aren't single quotes.
when i open in a new window i get all the csv info formatted correctly but now download dialogue.
i'm not sure what the symbol is called but they aren't single quotes.
when i open in a new window i get all the csv info formatted correctly but now download dialogue.
Why can't I get it ? Any other query criteria ?
ASKER
have you run through it in FF?
" i love technology "
" i love technology "
FF ?
ASKER
firefox
Nope. IE
ASKER
thats the problem. its working as intended in Firefox.
however IE is not working as intended.
however IE is not working as intended.
No, I was asking whats the criteria to return values. I choose Member ID > 300 and it says 0 records
ASKER
are you positive you we're in the members qmaster and not the donations?
i get 15 records when i run > 300 query
i get 15 records when i run > 300 query
OK Now got it. Could you use post to open the CSV. I can see you are passing long string in URL to open the CSV
This is wrong
Your code is : Response.ContentType = "text/csv"
Should be Response.ContentType = "application/csv"
Your code is : Response.ContentType = "text/csv"
Should be Response.ContentType = "application/csv"
ASKER
tried using post instead.
no luck in ie still
tried changing text to application
still no luck in ie.
However it still works great in Firefox.
Did i mention i LOVE IE?
no luck in ie still
tried changing text to application
still no luck in ie.
However it still works great in Firefox.
Did i mention i LOVE IE?
Actually, I use exactly this, and works fine in IE: (no buffer)
FileName="somefile.csv" 'default file name
<%
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
Set DBConn = Server.CreateObject("ADODB .Connectio n")
DBConn.Open Session("conn")
sql = "SELECT * from TABLENAME"
set rs = dbconn.Execute(sql)
if not rs.eof then
do until rs.eof
Response.Write rs("field") & "," & vbcrlf
rs.movenext
loop
end if
%>
It prompts for Save As and Saves as csv.
FileName="somefile.csv" 'default file name
<%
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
Set DBConn = Server.CreateObject("ADODB
DBConn.Open Session("conn")
sql = "SELECT * from TABLENAME"
set rs = dbconn.Execute(sql)
if not rs.eof then
do until rs.eof
Response.Write rs("field") & "," & vbcrlf
rs.movenext
loop
end if
%>
It prompts for Save As and Saves as csv.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it just writes out recordset in csv format.
i'll try rebooting after this post.
thanks,
i'll try rebooting after this post.
thanks,
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually:
<%
FileName="somefile.csv" 'default file name
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
Set DBConn = Server.CreateObject("ADODB .Connectio n")
DBConn.Open Session("conn")
sql = "SELECT * from TABLENAME"
set rs = dbconn.Execute(sql)
if not rs.eof then
do until rs.eof
Response.Write rs("field") & "," & rs("field2") & vbcrlf
rs.movenext
loop
end if
%>
Minus the SQL changes, that's all that is in the page, and works fine. Over 150,000 records.
<%
FileName="somefile.csv" 'default file name
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=" & FileName & ";"
Set DBConn = Server.CreateObject("ADODB
DBConn.Open Session("conn")
sql = "SELECT * from TABLENAME"
set rs = dbconn.Execute(sql)
if not rs.eof then
do until rs.eof
Response.Write rs("field") & "," & rs("field2") & vbcrlf
rs.movenext
loop
end if
%>
Minus the SQL changes, that's all that is in the page, and works fine. Over 150,000 records.
And yes, application/csv should work as well.
But I think your issue is a browser setting.
But I think your issue is a browser setting.
ASKER
ok so restarting did the trick.
i'll have to see if it's working for the client. i'll post back.
THANKS everyone!
i'll have to see if it's working for the client. i'll post back.
THANKS everyone!
Boy !!!
>>ok so restarting did the trick.
Of course it did <grin>...this issue sounded to hokie to be code related!
Glad to help!
Of course it did <grin>...this issue sounded to hokie to be code related!
Glad to help!
???
ASKER
the client is having 0 problems now
thanks guys.
*another a$$ saved by EE
thanks guys.
*another a$$ saved by EE
May I know how come you have not awarded me some points on this ?
ASKER
i thought i split them 100/100
ASKER
you didn't get the 100?
No did not.Look above.
Please post a Q to CS to change it
Please post a Q to CS to change it
ASKER
dude, so sorry.
i guess i need to buff up on my ee point splitting skills.
i posted to cs:
https://www.experts-exchange.com/questions/21739874/point-split-mistake.html
i guess i need to buff up on my ee point splitting skills.
i posted to cs:
https://www.experts-exchange.com/questions/21739874/point-split-mistake.html
Thanks
Thanks Dude
ASKER
did you get the points?
Yep
ASKER
excellent,
sorry again. and i really appreciate your dedicated help.
Briston
sorry again. and i really appreciate your dedicated help.
Briston
It shouldn't...I use that code in IE all the time. If you take that code out, does the recordset display to the screen properly?