469,625 Members | 1,138 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

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 1357
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by JG | last post: by
5 posts views Thread by andrewcw | last post: by
1 post views Thread by Martin | last post: by
reply views Thread by a | last post: by
7 posts views Thread by .... | last post: by
10 posts views Thread by John Kraft | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.