473,386 Members | 1,712 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,386 software developers and data experts.

text file

Hello,
I am using asp classical and connection to SQL 2000 on a Windows 2000
machine.
I am using this code to generate a text file when the user clicks on the
link. This is so the user can download the file on an as needed basis.
DIM filename
filename = "Companies.txt"
Response.ContentType = "Unknown"
Response.AddHeader "content-disposition", "attachment;filename=""" &
filename & """"

The issue I am having is if the text file is less than approx. 1 mb then the
file downloads fine. If the file is bigger than that I get this error:
"Internet Explorer cannot download <the name of the asp page> from <the name
of the website> Internet Explorer was not able to open this internet site.
The requested site is either unavailable or cannot be found. Please try
again later."

I get my data here:
DIM rs, strSQL
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
strSql = "stored procedure" & param1 & "," & param2
rs.Open strSql ,objConn ,adOpenForwardOnly ,adLockReadOnly ,adCmdtext

I then write it to a text file like this:

<%
Response.Write "CompanyName" & "|"
if not rs.BOF and not rs.EOF then
rs.MoveFirst
Do until rs.EOF
Response.Write rs.fields("Company_Name")& "|"
rs.MoveNext
Loop
end if
rs.Close
Set rs= nothing
%>

There are many more fields that are being returned but to keep it short I
only included one so you could see the layout of my code.

If someone could help me I would appreciate it.
If you need more information please let me know.

Thanks Gary
Oct 13 '05 #1
4 3086
If you comment out the part that prompts this to be a file download and just
let everything response.write out normally, what do you get?

Ray at home

"Gary" <ga***@mcgix.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
Hello,
I am using asp classical and connection to SQL 2000 on a Windows 2000
machine.
I am using this code to generate a text file when the user clicks on the
link. This is so the user can download the file on an as needed basis.
DIM filename
filename = "Companies.txt"
Response.ContentType = "Unknown"
Response.AddHeader "content-disposition", "attachment;filename=""" &
filename & """"

The issue I am having is if the text file is less than approx. 1 mb then
the file downloads fine. If the file is bigger than that I get this error:
"Internet Explorer cannot download <the name of the asp page> from <the
name of the website> Internet Explorer was not able to open this internet
site. The requested site is either unavailable or cannot be found. Please
try again later."

I get my data here:
DIM rs, strSQL
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
strSql = "stored procedure" & param1 & "," & param2
rs.Open strSql ,objConn ,adOpenForwardOnly ,adLockReadOnly ,adCmdtext

I then write it to a text file like this:

<%
Response.Write "CompanyName" & "|"
if not rs.BOF and not rs.EOF then
rs.MoveFirst
Do until rs.EOF
Response.Write rs.fields("Company_Name")& "|"
rs.MoveNext
Loop
end if
rs.Close
Set rs= nothing
%>

There are many more fields that are being returned but to keep it short I
only included one so you could see the layout of my code.

If someone could help me I would appreciate it.
If you need more information please let me know.

Thanks Gary

Oct 14 '05 #2
Ray, thanks for the reply.
I commented out the item you sugested and I get the following error.
"Response Buffer Limit Exceeded"

"Execution of the ASP page caused the Response Buffer to exceed its
configured limit."

is there any way to get around this limit?

How do I configure the Response Buffer Limit?

Thanks

Gary

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eT*************@TK2MSFTNGP15.phx.gbl...
If you comment out the part that prompts this to be a file download and
just let everything response.write out normally, what do you get?

Ray at home

"Gary" <ga***@mcgix.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
Hello,
I am using asp classical and connection to SQL 2000 on a Windows 2000
machine.
I am using this code to generate a text file when the user clicks on the
link. This is so the user can download the file on an as needed basis.
DIM filename
filename = "Companies.txt"
Response.ContentType = "Unknown"
Response.AddHeader "content-disposition", "attachment;filename=""" &
filename & """"

The issue I am having is if the text file is less than approx. 1 mb then
the file downloads fine. If the file is bigger than that I get this
error:
"Internet Explorer cannot download <the name of the asp page> from <the
name of the website> Internet Explorer was not able to open this
internet site. The requested site is either unavailable or cannot be
found. Please try again later."

I get my data here:
DIM rs, strSQL
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
strSql = "stored procedure" & param1 & "," & param2
rs.Open strSql ,objConn ,adOpenForwardOnly ,adLockReadOnly ,adCmdtext

I then write it to a text file like this:

<%
Response.Write "CompanyName" & "|"
if not rs.BOF and not rs.EOF then
rs.MoveFirst
Do until rs.EOF
Response.Write rs.fields("Company_Name")& "|"
rs.MoveNext
Loop
end if
rs.Close
Set rs= nothing
%>

There are many more fields that are being returned but to keep it short I
only included one so you could see the layout of my code.

If someone could help me I would appreciate it.
If you need more information please let me know.

Thanks Gary


Oct 14 '05 #3
Gary wrote:
Ray, thanks for the reply.
I commented out the item you sugested and I get the following error.
"Response Buffer Limit Exceeded"

"Execution of the ASP page caused the Response Buffer to exceed its
configured limit."

is there any way to get around this limit?

How do I configure the Response Buffer Limit?

Turn off buffering for the page?

Response.buffer = false

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 14 '05 #4
"Bob Barrows [MVP]" wrote in message
news:ea*************@TK2MSFTNGP12.phx.gbl...
: Gary wrote:
: > Ray, thanks for the reply.
: > I commented out the item you sugested and I get the following error.
: > "Response Buffer Limit Exceeded"
: >
: > "Execution of the ASP page caused the Response Buffer to exceed its
: > configured limit."
: >
: > is there any way to get around this limit?
: >
: > How do I configure the Response Buffer Limit?
: >
: >
: >
: Turn off buffering for the page?
:
: Response.buffer = false

Interesting. My download routine has buffering on and I just tested
downloading a 2Mb file and it worked fine. Also, I missed the part where
the OP wrote the text to the file. I only see it written to the screen.
Could that be the issue for the buffer depletion?
My download routine is a little more complex that what it shown here as this
appears to not be complete but I don't think the download itself is the
issue.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Oct 17 '05 #5

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

Similar topics

22
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
1
by: Rigga | last post by:
Hi, I am new to Python and need to parse a text file and cut parts out i.e. say the text file contained 5 rows of text: line 1 of the text file line 2 of the text file line 3 of the text...
27
by: Eric | last post by:
Assume that disk space is not an issue (the files will be small < 5k in general for the purpose of storing preferences) Assume that transportation to another OS may never occur. Are there...
16
by: thenightfly | last post by:
Ok, I know all about how binary numbers translate into text characters. My question is what exactly IS a text character? Is it a bitmap?
7
by: Chris | last post by:
Hi I can use a text file as a datasource but am unable to get the datatable to see the text file as having multiple columns. Everything gets put into the first column in the datatable. Sample of...
3
by: bbepristis | last post by:
Hey all I have this code that reads from one text file writes to another unless im on a certian line then it writes the new data however it only seems to do about 40 lines then quits and I cant...
1
by: Osoccer | last post by:
...to a different folder and in the relocated file concatenates all of the lines in one long string with a space between each line element. Here is a fuller statement of the problem: I need a...
10
by: bluemountain | last post by:
Hi there, Iam new to python forms and programming too I had a text file where i need to extract few words of data from the header(which is of 3 lines) and search for the keyword TEXT1, TEXT2,...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.