Richtext control characters "@"

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hi,

When reading a number richtext strings back from a database c# adds
the @ operator to the string, the effect being all the control
characters are ignored and the string cannot be added to a richtextbox.
I'm using a stored procedure to get the data and the data type is
varchar in the database and stored procedure.

Any assistance on suppress c# from adding the @ operator would be much
appreciated. Code shown below:

Thanks
Lee

SqlCommand sqlComm = new SqlCommand();
SqlDataReader sqlData = null;

sqlData = sqlComm.ExecuteReader ();

/ Obtain all the data.
while (sqlData.Read())
{
if (sqlData["Text"] != DBNull.Value)
{
m_text = sqlData["Text"].ToString(); // m_text has @
preceeding the string.
}
}
 
Hi,

C# isn't adding anything to your strings.

In the debugger, you may see the verbatim literal string character, @, added
outside of the string. That @ character tells C# (and the debugger) to
ignore escape sequences in the string that follows, such as, \n, instead of
processing them.

The value of your m_text variable is what was retrieved from
sqlData["Text"].ToString() regardless of the way it's being presented to you
in the debugger.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top