Basically, the exact same question as this:
基本上,完全相同的问题:
Storing Lyrics in a MySQL database
将歌词存储在MySQL数据库中
except I'm using SQL Server with a C# / asp.net front end. I don't need them searchable, I just want to retrieve them and have them formatted (i.e. line breaks) properly when displayed.
除了我使用带有C#/ asp.net前端的SQL Server。我不需要它们可搜索,我只想检索它们并在显示时正确地格式化(即换行符)。
2 个解决方案
#1
1
Just store as nvarchar(max) data type.
只需存储为nvarchar(max)数据类型。
Note, if you pull the column out with SSMS, it won't have formatting (SSMS itself strips all CR/LFs), but if you extract it with C#, it will be retained exactly as it went in, and you can display as you wish.
请注意,如果您使用SSMS拉出列,它将没有格式化(SSMS本身会剥离所有CR / LF),但是如果您使用C#提取它,它将完全保留,因为它进入,您可以显示为你希望。
#2
0
Create your table as usual
像往常一样创建你的表
CREATE TABLE [ExampleName] (id int primary key
/*your other values...*/
,lyric nvarchar(max))
and then you just save the lyrics in there depending on how you handle database access.
然后你只需将歌词保存在那里,具体取决于你如何处理数据库访问。
#1
1
Just store as nvarchar(max) data type.
只需存储为nvarchar(max)数据类型。
Note, if you pull the column out with SSMS, it won't have formatting (SSMS itself strips all CR/LFs), but if you extract it with C#, it will be retained exactly as it went in, and you can display as you wish.
请注意,如果您使用SSMS拉出列,它将没有格式化(SSMS本身会剥离所有CR / LF),但是如果您使用C#提取它,它将完全保留,因为它进入,您可以显示为你希望。
#2
0
Create your table as usual
像往常一样创建你的表
CREATE TABLE [ExampleName] (id int primary key
/*your other values...*/
,lyric nvarchar(max))
and then you just save the lyrics in there depending on how you handle database access.
然后你只需将歌词保存在那里,具体取决于你如何处理数据库访问。