|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Render HTML doc as Excel
some reason it's not anymore, not sure why, I think it's related to permissions, we recently added a domain user as the anonymous user for the site, everyone has permissions to the virtual directory where the asp page is executed.... Can someone give an idea as to why this is not working...? Here's the error message I'm getting, from Excel: Microsoft Excel cannot access the file 'http://BLAHBLAH.ASP?queryparams' There are several possible reasons * The file name or path does not exist * The file you are trying to open is being used by another program. Here's the ASP code... <%@ LANGUAGE="VBSCRIPT"%> <% option explicit Response.Expires = 0 Response.ContentType = "application/vnd.ms-excel" %> <!--#include virtual="/Include/odbvbs.asp"--> <% dim sSQL, anon, begdate, enddate, sortby, oRS call ConnInit(cINTERNET) anon = Request("ADDRESSED") if anon = "Anonymous" then anon = "true" end if begdate = Request("BEGINDATE") enddate = Request("ENDDATE") sortby = Request("SORTBY") if sortby = "Date" then sortby = "request_date" end if sSQL = "Select * "_ & "from requests (nolock) "_ & "where (request_date) >= '" +begdate+ "' AND (request_date) <= '" +enddate+ "' " if anon = "true" then sSQL = sSQL + "AND (email) = 'blank' " else sSQL = sSQL + "AND (email) <> 'blank' " end if sSQL = sSQL + "ORDER BY " + sortby 'response.write(sSQL) set oRS = obINTERNET.Execute(sSQL) call QueueRS(oRS) if not oRS.EOF then %> <html> <table border=2> <tr> <td><b>Request Date</b></td> <td><b>Email</b></td> <td><b>Name</b></td> <td><b>Product</b></td> </tr> <% Do While Not oRS.EOF %> <tr> <td><% = oRS("request_date")%></td> <td><% = oRS("email")%></td> <td><% = oRS("name")%></td> <td><% = oRS("product")%></td> </tr> <% oRS.MoveNext Loop %> <% end if %> <% oRS.Close obCC %> </html> I commented the ContentType declaration out and found it somebody removed the
database... The nerve of some people...;) Show quote "Alien2_51" wrote: > This is a simple report that is supposed to render as an Excel document, for > some reason it's not anymore, not sure why, I think it's related to > permissions, we recently added a domain user as the anonymous user for the > site, everyone has permissions to the virtual directory where the asp page is > executed.... Can someone give an idea as to why this is not working...? > > Here's the error message I'm getting, from Excel: > Microsoft Excel cannot access the file 'http://BLAHBLAH.ASP?queryparams' > There are several possible reasons > * The file name or path does not exist > * The file you are trying to open is being used by another program. > > > Here's the ASP code... > > <%@ LANGUAGE="VBSCRIPT"%> > <% > option explicit > Response.Expires = 0 > Response.ContentType = "application/vnd.ms-excel" > %> > > <!--#include virtual="/Include/odbvbs.asp"--> > > <% > dim sSQL, anon, begdate, enddate, sortby, oRS > > call ConnInit(cINTERNET) > > anon = Request("ADDRESSED") > if anon = "Anonymous" then > anon = "true" > end if > > begdate = Request("BEGINDATE") > enddate = Request("ENDDATE") > sortby = Request("SORTBY") > > if sortby = "Date" then > sortby = "request_date" > end if > > sSQL = "Select * "_ > & "from requests (nolock) "_ > & "where (request_date) >= '" +begdate+ "' AND (request_date) <= '" > +enddate+ "' " > if anon = "true" then > sSQL = sSQL + "AND (email) = 'blank' " > else > sSQL = sSQL + "AND (email) <> 'blank' " > end if > > sSQL = sSQL + "ORDER BY " + sortby > > 'response.write(sSQL) > set oRS = obINTERNET.Execute(sSQL) > > call QueueRS(oRS) > > if not oRS.EOF then > %> > > <html> > <table border=2> > <tr> > <td><b>Request Date</b></td> > <td><b>Email</b></td> > <td><b>Name</b></td> > <td><b>Product</b></td> > </tr> > <% Do While Not oRS.EOF %> > <tr> > <td><% = oRS("request_date")%></td> > <td><% = oRS("email")%></td> > <td><% = oRS("name")%></td> > <td><% = oRS("product")%></td> > </tr> > > <% > oRS.MoveNext > Loop > %> > <% > end if > %> > <% > oRS.Close > obCC > %> > </html> <<
I commented the ContentType declaration out and found it somebody removed the database... The nerve of some people...;) >> Thanks for letting everyone know what the answer was! :)Best regards, J. Paul Schmidt, Freelance ASP Web Developer http://www.Bullschmidt.com ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool... *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
|||||||||||||||||||||||