473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

ASP Page not opening a new Excel Spreadsheet each time.

lds
I have inhertited and old asp application that I have to make a few
changes to and I am having difficulties with a page that retrives data
from the database, and places it into an Excel spreadsheet. It seemed
to be working fine in the beginning, but not anymore. The only thing
that I know of that could be different is that I installed J2SE Runtime
Environment 5.0 Update 6. I have since uninstalled it just to see if
it makes any difference, which it did not.

How the page works, is that the user selects different fields to be
displayed as well as the criteria for the query. A select statement is
created and executed against the database. The page then loops though
the records returned creating a table. The Response.ContentType =
"application/vnd.ms-excel"

Sometimes it works the first time, but then if you go back, change the
selection criteria and/or fields to be displayed and submit the form
again, you get the same results as the last query. I have checked to
make sure that the query itself changes and it does.

Here is a sample of the code being used:

Set rs0 = Server.CreateObject("ADODB.Recordset")
rs0.open strsql, cn
If not rs0.BOF and not rs0.EOF then
Response.Clear
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
rs0.MoveFirst%>
<HTML>
<HEAD>
<META HTTP-EQUIV="no-cache">
</HEAD>
<BODY>
<p>&nbsp;
<table border=0 cols=<%=rs0.Fields.Count%> ID="Table1">
<tr>
<%for each oField in rs0.Fields%>
<th><%=oField.name%></th>
<%next%>
</tr>
<%do while not rs0.EOF %>
<tr>
<%for each oField in rs0.Fields%>
<td align=left>
<%if IsNull(oField) then
Response.Write "&nbsp;"
else
Response.Write (oField.Value)
end if%>
</td>
<%next
rs0.MoveNext
%>
</tr>
<%loop%>
</table>
<%end if%>
</BODY>
</HTML>

Jan 4 '06 #1
2 1726
lds
I just thought that I would add that this has started working for me
again. The only thing I did was delete my recent documents and files
in my temp directory. I guess I just need to figure out why there was
a copy there to begin with...

Jan 4 '06 #2
lds
I just thought that I would add that this has started working for me
again. The only thing I did was delete my recent documents and files
in my temp directory. I guess I just need to figure out why there was
a copy there to begin with...

Jan 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jawahar Rajan | last post by:
All, I am using the ASP code below to save some data from a SQL Server database via ADO as an Excel spreadsheet strReportName = Request.QueryString("ReportName") If len(strReportName) > 0 then...
1
by: Ben | last post by:
I am able to sucessfully open/save an asp page that contains table data in an Excel format using: Response.ContentType = "application/vnd.ms-excel" The purpose of this functionality is to...
3
by: Ken Hall | last post by:
Is it possible to create an Excel spreadsheet using VB.NET without opening the Excel application or having to have the Excel application on the operating computer? KH
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
0
by: lds | last post by:
I have inhertited and old asp application that I have to make a few changes to and I am having difficulties with a page that retrives data from the database, and places it into an Excel...
1
by: Mr. Novice | last post by:
A co-worker and I have a VB.Net app that is used to open applications using a different set of credentials. If somebody has Excel opened and then tries to open another spreadsheet using the app...
1
by: Mitch | last post by:
I am using Access to create an Excel spreadsheets with graphs related to rows on the sheet1 to the graph on sheet2. I am using the same data but different subsets of the data to make different...
6
by: gumbystation | last post by:
I am looking to take data from an excel spreadsheet into a csharp application to manipulate the data in various ways. Currently, I am using VS2005 (self-taught C#) and Excel 2000. I have...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.