By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

asp .net loading carriage returns from SQL

P: n/a
Hi all,

I am having a frustration problem, and I have read about 25 newsgroup
postings that do not have a satisfying answer :)

The problem appears to be common where carriage returns are lost when
pulling data from an SQL database. The thing that frustrates me the
most, is that when I use Enterprise Manager, the carriage returns ARE
THERE. It looks fine until I pull it out.

Background: My application keeps a history of what is being done to
the records...a very simply history. Who accessed it, when, and
summary of what was done. Here is the code I use to add the history:

cmdInsertIncident.Parameters.Add( "@history", "----------" &
Environment.Newline & session("user_id") & " " & datetime.now() &
Environment.NewLine & "Incident created." & Environment.Newline &
"----------" & Environment.Newline )

the result should be something like this:

--------------
emm037 September 09, 2004 5:38
Incident created
--------------

and this is what Enterprise manager shows, but when i pull it back out
I get:

--------------emm037 September 09, 2004 5:38Incident
created--------------

As the history gets longer...it looks worse.

I don't know if my problem is the same as others or it has to do with
using the Environment.Newline for a carriage return.

All suggestions are appreciated. Without you guys, I would have never
gotten this far with this application :)
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Matt,

I may be way out of the line here but from my previous experience for any
web page display i never used carriage returns rather used "<br>" to insert
a newline.
so see whether carriage returns are indeed being returned.. go to page >>
view >> source in IE and you should have the carriage returns. only
browsers dont do anything about them.

do a find replace on Environment.Newline with "<br>" that should get your
the breaks at right places in asp.net.

i have just given Environment.Newline to assign a label and it inserts a
carriage return line feed to html but since its not a <br> its not formatted
by the browser.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Matt Mercer" <ma******@bellsouth.net> wrote in message
news:37**************************@posting.google.c om...
Hi all,

I am having a frustration problem, and I have read about 25 newsgroup
postings that do not have a satisfying answer :)

The problem appears to be common where carriage returns are lost when
pulling data from an SQL database. The thing that frustrates me the
most, is that when I use Enterprise Manager, the carriage returns ARE
THERE. It looks fine until I pull it out.

Background: My application keeps a history of what is being done to
the records...a very simply history. Who accessed it, when, and
summary of what was done. Here is the code I use to add the history:

cmdInsertIncident.Parameters.Add( "@history", "----------" &
Environment.Newline & session("user_id") & " " & datetime.now() &
Environment.NewLine & "Incident created." & Environment.Newline &
"----------" & Environment.Newline )

the result should be something like this:

--------------
emm037 September 09, 2004 5:38
Incident created
--------------

and this is what Enterprise manager shows, but when i pull it back out
I get:

--------------emm037 September 09, 2004 5:38Incident
created--------------

As the history gets longer...it looks worse.

I don't know if my problem is the same as others or it has to do with
using the Environment.Newline for a carriage return.

All suggestions are appreciated. Without you guys, I would have never
gotten this far with this application :)

Nov 18 '05 #2

P: n/a
In HTML, carriage returns are "white-space" characters. This set of
characters includes the space, tab, carriage return, and similar characters
which don't render anything but space. In HTML, white space characters are
treated as a single space, no matter how many consecutive white-space
characters there are. The HTML for a carriage return is the <br> tag.
Replace the carriage returns in the data you fetch with <br> tags, and all
will be well.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Matt Mercer" <ma******@bellsouth.net> wrote in message
news:37**************************@posting.google.c om...
Hi all,

I am having a frustration problem, and I have read about 25 newsgroup
postings that do not have a satisfying answer :)

The problem appears to be common where carriage returns are lost when
pulling data from an SQL database. The thing that frustrates me the
most, is that when I use Enterprise Manager, the carriage returns ARE
THERE. It looks fine until I pull it out.

Background: My application keeps a history of what is being done to
the records...a very simply history. Who accessed it, when, and
summary of what was done. Here is the code I use to add the history:

cmdInsertIncident.Parameters.Add( "@history", "----------" &
Environment.Newline & session("user_id") & " " & datetime.now() &
Environment.NewLine & "Incident created." & Environment.Newline &
"----------" & Environment.Newline )

the result should be something like this:

--------------
emm037 September 09, 2004 5:38
Incident created
--------------

and this is what Enterprise manager shows, but when i pull it back out
I get:

--------------emm037 September 09, 2004 5:38Incident
created--------------

As the history gets longer...it looks worse.

I don't know if my problem is the same as others or it has to do with
using the Environment.Newline for a carriage return.

All suggestions are appreciated. Without you guys, I would have never
gotten this far with this application :)

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.