tags:

views:

26

answers:

0

Hi,

I'm reading a varchar field from SQL Server 2008, get a DataRow object, and I convert it to a string variable, using VB.NET 2008 (.NET Framework 3.5).

The varchar field unfortunately contains formatting (tabulation, line breaks, etc), and when I convert it to string the formatting is lost.

The odd thing is, when I query the value of the DataRow on the "inmediate" window, it displays the text correctly, but when it is copied to the variable, it loses the formatting.

The code is:

_fieldName = Convert.ToString(objDataRow("field"))

_fieldname is a String, and objDataRow is a DataRow object

The database is using the SQL_Latin1_General_CP1_CI_AS collation if that helps answer the question.

The field is a varchar(2000)

Edit: maybe it has something to do with the Encoding?

Thanks in advance,

Gustavo