Use the nchar function, no nvarchar function with SQL Server Compact:
Replacing a specified nvarchar string in database column with a carriage return in sql-ce
-
15-10-2022 - |
Question
When not using the nvarchar and replacing with another string i.e.'test' I get the expected replacing results. I am attempting to insert a carriage return
private void reformatData(SqlCeConnection conn)
{
try
{
SqlCeCommand comm = new SqlCeCommand("UPDATE database " + "SET column = replace(MoodLog, '[ret]', nvarchar(13));", conn);
comm.ExecuteNonQuery();
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.ToString());
}
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow