Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert a line break into a sql statement

Posted on 2006-11-29
6
Medium Priority
?
354 Views
Last Modified: 2007-12-19
Ok, here's the deal...

I have an asp.net form where people can update comments.  The form updates to a sql db each time they submit the form.  What I want to do is add a line break before the update statement so that when I pull all the comments from the DB there is some spacing between each comment.  

Like so:

11/28/2006 8:40:43 AM The sleek HP iPAQ hw6920 and hw6925 Mobile Messenger is a global communications device giving you the best in connectivity, productivity, and mobility to stay connected on the go.

11/29/2006 9:00:00 AM This world phone uses the Sprint CDMA/EV-DO networks in the U.S., Canada and Mexico, and roams on CDMA and/or GSM networks (voice) and GPRS networks (data) outside of North America


Right now I'm getting this:

11/28/2006 8:40:43 AM The sleek HP iPAQ hw6920 and hw6925 Mobile Messenger is a global communications device giving you the best in connectivity, productivity, and mobility to stay connected on the go. 11/29/2006 9:00:00 AM This world phone uses the Sprint CDMA/EV-DO networks in the U.S., Canada and Mexico, and roams on CDMA and/or GSM networks (voice) and GPRS networks (data) outside of North America

I tried adding vbCrLf and "<br>"  to the update statement but apparently ASP.net doesn't like having either of those in the update statement because it gives me an error about it being malicious code or something to that effect.  

Idea's ? Workarounds ?
0
Comment
Question by:intchauspe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18037353
>but apparently ASP.net doesn't like having either of those
can you show the code you try to use?  the "<br>" stuff should work?...
0
 

Author Comment

by:intchauspe
ID: 18038550
txtDesc.Text & " " & Date.Now & " " & txtUpdates.Text & " " & "<BR>"

that will update but it add a literal <br> to the text like so:

11/29/2006 9:00:00 AM This world phone uses the Sprint CDMA/EV-DO networks in the U.S., Canada and Mexico, and roams on CDMA and/or GSM networks (voice) and GPRS networks (data) outside of North America <br>

then what happens is when I pull that text and try to add a new comment it freaks out because of the <br> and it gives the following error:

A potentially dangerous Request.Form value was detected from the client (ctl00$main$RepeaterDesc$ctl00$lblDesc="...vironment <BR>").



0
 

Author Comment

by:intchauspe
ID: 18039971
Figured it out......

txtDesc.Text & " " & Date.Now & " " & txtUpdates.Text & " " & CHAR(13)
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18042737
Since you are using VB.NET, I suspect you mean
txtDesc.Text & " " & Date.Now & " " & txtUpdates.Text & " " & CHR(13)

Or more simply:
txtDesc.Text & " " & Date.Now & " " & txtUpdates.Text & " " & vbCr
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18077171
PAQd, 500 points refunded.

DarthMod
CS Moderator
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question