472,958 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

ASP.NET stream writer problem

I'm writing a file out using StreamWriter. What i'm outputting is a 6,398
lines of stupid Jscript arrays.
Yes the system needs to be very very dynamic, and they don't want a page
reload.

The arrays are so huge because the program needs:
Take table 1, and join each row in table 1 to X rows in Table 2.
Take each row in table 2 and assign it to X rows in table 3.
Take each row in table 3 and assign it to X rows in table 4... and so on.
ick.

It runs the code, and writes the file, but only writes half of the file.
The stream getting output is over 300KB long.

It might be that the string datatype is too short to hold all this
information so I switched:

MyString &= "..."
to
objStreamWriter.WriteLine("...")

This too only generates only half the file. It outputs about 120 KB of
data. Using another utility to create this file from the DB it makes it 300
kb, and the code is Exactly the same.

The stream writer hits every section of it. Even the closing </script> tag,
but the file gets cut in half.

Here's how i'm declaring the stream writer:
-----------------
Dim objStreamWriting as new
System.IO.StreamWriter(objUtil.server.MapPath("/Classification.js",False)

objStreamWriting.WriteLine("<script language=""JavaScript"">")
.....
For loop 1
....
For loop 2
....
For loop 3
.... inside this loop is where it will usually end. Around line # 2097
....
objStreamWriting.WriteLine("</script>")

objStreamWriting.Close
objStreamWriting = nothing
Anyone have any suggestions?
Nov 18 '05 #1
1 1447
Hmm... The little elf reminded me to always flush after doing something
dirty....
It worked :D

/RT
"Ryan Ternier" <[no-spam]rt******@icompasstech.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...
I'm writing a file out using StreamWriter. What i'm outputting is a 6,398
lines of stupid Jscript arrays.
Yes the system needs to be very very dynamic, and they don't want a page
reload.

The arrays are so huge because the program needs:
Take table 1, and join each row in table 1 to X rows in Table 2.
Take each row in table 2 and assign it to X rows in table 3.
Take each row in table 3 and assign it to X rows in table 4... and so on.
ick.

It runs the code, and writes the file, but only writes half of the file.
The stream getting output is over 300KB long.

It might be that the string datatype is too short to hold all this
information so I switched:

MyString &= "..."
to
objStreamWriter.WriteLine("...")

This too only generates only half the file. It outputs about 120 KB of
data. Using another utility to create this file from the DB it makes it
300 kb, and the code is Exactly the same.

The stream writer hits every section of it. Even the closing </script>
tag, but the file gets cut in half.

Here's how i'm declaring the stream writer:
-----------------
Dim objStreamWriting as new
System.IO.StreamWriter(objUtil.server.MapPath("/Classification.js",False)

objStreamWriting.WriteLine("<script language=""JavaScript"">")
....
For loop 1
...
For loop 2
...
For loop 3
... inside this loop is where it will usually end. Around line # 2097
...
objStreamWriting.WriteLine("</script>")

objStreamWriting.Close
objStreamWriting = nothing
Anyone have any suggestions?

Nov 18 '05 #2

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

Similar topics

18
by: JG | last post by:
Does anyone know a standard (or supported on Linux, Mac, Win32) way to clear a read stream buffer (standard ANSI C file stream)? I would even settle for a platform specific way of doing it. ...
5
by: andrewcw | last post by:
I have an object to serialize. TextWriter writer = new StreamWriter("test.xml"); serializer.Serialize(writer,obj); writer.Close(); but below does not, why ?? I have a file that I will have...
1
by: Martin | last post by:
Hi Im trying to make a Client/Server where im going to encrypt the stream but i cant get it to work. I can recieve and send as long as im not trying to send/recieve encrypted. but when i am i cant...
0
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
8
by: Marc Gravell | last post by:
I want to write a method that will accept a stream as a parameter, and which will write xml to the stream (based in reality on database results) using the XmlTextWriter class. However, this insists...
7
by: .... | last post by:
Hi I have an existing function which has a stream object (inmsg.BodyPart.Data). I'm trying to search and replace the stream object in the most efficient way possible This is my attempt below,...
10
by: John Kraft | last post by:
Hello all, I'm experiencing some, imo, strange behavior with the StreamReader object I am using in the code below. Summary is that I am downloading a file from a website and saving it to disk...
2
by: Mikus Sleiners | last post by:
I'm trying to write new stream from string and i can't figure out why my memory stream instance is null after i have writen to it with stream writer. Here is an example. MemoryStream stream =...
1
by: pax82 | last post by:
hi, sorry for my english but i don't speak good english. in this web service i send 2 data stream(xml and xsl file) and i would like to return a xslt trasform-file byte array (now i return string...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.