T
TomTom
Hi,
I have a simple command.ExecuteNonQuery() to insert some data into the SQL
DB. The data can be inserted, but the characters like '\n' are somehow
stripped during the process. I want to keep it.
My code looks like below.
SqlCommand insertCommand = new SqlCommand();
SqlCommand command = new SqlCommand();
command.CommandText = "up_parm_insert_data_into_sql"; // This stored
procedure includes a very simple INSERT statement.
command.CommandType = CommandType.StoredProcedure;
SqlParameter [] sqlParams = new SqlParameter[1];
sqlParams[0] =
command.Parameters.Add("@myParameterText",SqlDbType.NVarChar);
sqlParams[0].Direction = ParameterDirection.Input;
// dataRow["myDataColumn"].ToString() incluedes the following text. Please
note that the text includes '\n'.
// Merry Cristmas. \n Wish you happy programming in 2005."
sqlParams[0].Value = dataRow["myDataColumn"].ToString();
command.Connection = sqlConnection;
command.ExecuteNonQuery();
Does someone know how I can preserve \n in the SQL DB? During the insert
process it appears to be lost.
TomTom
I have a simple command.ExecuteNonQuery() to insert some data into the SQL
DB. The data can be inserted, but the characters like '\n' are somehow
stripped during the process. I want to keep it.
My code looks like below.
SqlCommand insertCommand = new SqlCommand();
SqlCommand command = new SqlCommand();
command.CommandText = "up_parm_insert_data_into_sql"; // This stored
procedure includes a very simple INSERT statement.
command.CommandType = CommandType.StoredProcedure;
SqlParameter [] sqlParams = new SqlParameter[1];
sqlParams[0] =
command.Parameters.Add("@myParameterText",SqlDbType.NVarChar);
sqlParams[0].Direction = ParameterDirection.Input;
// dataRow["myDataColumn"].ToString() incluedes the following text. Please
note that the text includes '\n'.
// Merry Cristmas. \n Wish you happy programming in 2005."
sqlParams[0].Value = dataRow["myDataColumn"].ToString();
command.Connection = sqlConnection;
command.ExecuteNonQuery();
Does someone know how I can preserve \n in the SQL DB? During the insert
process it appears to be lost.
TomTom