473,467 Members | 1,514 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1730
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.