c# - 如何在DataBase中保存breakeline并在textarea winform c#中显示它
问题描述
我在数据库中保存了一个长字符串,我想在我的 winForm 的文本区域中显示它。
但我没有得到我想要的结果。
编码:
insert into table
(
Description
)
'ערך אחד: ' + convert(NVARCHAR, t1.MonthlyReturnAmount) +'\r\n'+
' ערך שני: ' + convert(NVARCHAR, t1.LastPaymentDate) +'\r\n'+
' ערך שלישי: ' + case WHEN t2.IsActive=0 then 'לא' else 'כן' END
from table1 t1
join table2 t2 on t1.id=t2.filed
在数据库中:
在文本区域:
而且它没有断线,为什么?
解决方案
假设这是针对 SQL Server 的,您可以使用该nchar()
函数获取字符编号 13、回车和 10(新行)。
insert into table
(
Description
)
'ערך אחד: ' + convert(NVARCHAR, t1.MonthlyReturnAmount) + nchar(13) + nchar(10) +
' ערך שני: ' + convert(NVARCHAR, t1.LastPaymentDate) + nchar(13) + nchar(10) +
' ערך שלישי: ' + case WHEN t2.IsActive=0 then 'לא' else 'כן' END
from table1 t1
join table2 t2 on t1.id=t2.filed
推荐阅读
- css - CSS nth-of-type(1) 不选择第一个元素
- r - 从 R 中的表中获取单个值
- javascript - 在angularjs中动态添加和删除元素的问题
- javascript - 接受时的 HTML/Javascript 输入图像触发操作
- linux - RT 进程如何为 CFS 进程释放 CPU,并在没有准备好的 CFS 进程时将其取回
- javascript - 在数组中搜索至少 1 个匹配项并返回 true
- angular - 升级到 Angular 8:在 tsconfig.json 中将目标更改为“es2015”会导致 polyfills-2015 出错
- makefile - 如何在 Make 中为多个模式规则共享相同的配方?
- angular - Angular @Input() 可能有也可能没有这个值
- python - 如何实时实现颜色一致的不闪烁深度图?