Solved

Insert a line break into a sql statement

Posted on 2006-11-29
6
341 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
6 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
>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
Comment Utility
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
Comment Utility
Figured it out......

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

Expert Comment

by:Anthony Perkins
Comment Utility
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
Comment Utility
PAQd, 500 points refunded.

DarthMod
CS Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now