473,378 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Problem with line breaks

I am having an issue with doing an insert or update of a record into a SQL
Server database from an ASP.NET. When I perform an insert or update of a
string with a line break with vbCrLf or Chr(13) & Chr(10) somehow the
Chr(13) gets removed or stripped off at the point of insert.

Example String:

a
b

The database shows it stored as "a" "square" "b". In ASCII Decimal Format,
values show as Chr(97) & Chr(10) & Chr(98) when it should be Chr(97) &
Chr(13) & Chr(10) & Chr(98). I have tried doing a replace just before the
Insert declaration to verify that all valid characters are there then insert
and still Chr(13) appears to get stripped out after inserted.

SAMPLE INSERT:

INSERT INTO MyTable (Field1, Field2) VALUES (@iField1, @iField2)

The web application calls a web service that performs this insert. Any
thoughts or ideas? Thanks in advance.

atr2000
Sep 19 '08 #1
1 1200
On Sep 19, 3:05*pm, "ATR2000" <some...@microsoft.comwrote:
I am having an issue with doing an insert or update of a record into a SQL
Server database from an ASP.NET. *When I perform an insert or update ofa
string with a line break with vbCrLf or Chr(13) & Chr(10) somehow the
Chr(13) gets removed or stripped off at the point of insert.

Example String:

a
b

The database shows it stored as "a" "square" "b". *In ASCII Decimal Format,
values show as Chr(97) & Chr(10) & Chr(98) when it should be Chr(97) &
Chr(13) & Chr(10) & Chr(98). *I have tried doing a replace just before the
Insert declaration to verify that all valid characters are there then insert
and still Chr(13) appears to get stripped out after inserted.

SAMPLE INSERT:

INSERT INTO MyTable (Field1, Field2) VALUES (@iField1, @iField2)

The web application calls a web service that performs this insert. *Any
thoughts or ideas? *Thanks in advance.

atr2000
I think the problem here could be due to a type of the field, encoding
in application and collation in the database. If you used UTF and char
or varchar data types, try to change the type to Nchar and Nvarchar.
If it's not the case, try to get the text back using SELECT FROM from
your .NET application to see what you really stored there.
Sep 20 '08 #2

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

Similar topics

1
by: Bill | last post by:
I am downloading data from a website that displays it in a table $fp = fopen("a website page", 'r'); The following accesses the stream one <td> element at a time $myData = fgets($fp); Then I...
0
by: Mike Cannon | last post by:
I'm having a problem with the newer version of win32all and Python 2.3 with code that works fine on Python-2.2 (details below). Both machines are Windows XP. The code that breaks is derived...
4
by: intl04 | last post by:
I have a memo field that is included in some Access reports I created. Is there some way for the memo field to display nicely formatted text, with line breaks between paragraphs? Or is it necessary...
2
by: Mike | last post by:
I need my textbox to work more smoothly with respect to line breaks. When I have data pulled from the database into a textbox there are hard line breaks at the end of each line (by definition how...
1
by: sck10 | last post by:
Hello, I am pulling data from a SQL Server table. One field that is (varchar 4000) is used to show notes. I am using a FormView for showing and editing the data. When the form is in Item...
5
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the...
52
by: celerysoup16 | last post by:
I've written this coin toss program, and can't figure out why it isn't giving accurate results... cheers, Ben #include <stdlib.h> #include <stdio.h> #define H 1 #define T 0 #define SENTINEL...
2
by: caspardh | last post by:
i was trying to code a morse code decipherer which workd fine except that the .txt file that i was converting had linebreaks built in, i cant get python to ignore the line breaks and i cant find any...
13
by: John Salerno | last post by:
I figured I might give myself a little project to make my life at work easier, so here's what I want to do: I have a large list of publication citations that are numbered. The numbers are simply...
2
by: andybdi | last post by:
I am playing with a few xml feeds changing them into different formats and merging them with others, and have found that when using cdata- section-elements salbatron adds an extra line break at the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.