如何在sqlserver中保存和检索粗体和斜体字 [英] How to save and retrieve Bold and Italic words in sqlserver

查看:221
本文介绍了如何在sqlserver中保存和检索粗体和斜体字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我如何在sqlserver中保存和检索粗体文本和para更改

我有一个文本框,用户想要从数据库检索时保存特定单词BOLD自己存储

Can Any One Tell Me That How To Save and Retrieve the Bold Text and para change in sqlserver
I have a text Box and user want to save a specific word BOLD when retrieve from database which was stored by himself

推荐答案

RTF HTML 格式保存数据



你可以使用 Richtextbox 控制



快乐编码!

:)
save data in RTF or HTML format

you can use Richtextbox control

Happy Coding!
:)


在保存到数据库时,您使用
While saving to database you fetch value using
innerHTML 

属性获取值将会为您提供带有html标记的文本在页面中检索和加载后,你需要使用

property witch will give you text with html tags and after retrieving and loading in page you need to use

Server.HtmlDecode(strValue)

methode转换回html格式。

其中strValue是varchar值,带有html标签'< b> bold< / b>'

methode to convert back to html format.
where strValue is the varchar value with html tag '<b>bold</b>'


只需使用编辑器并将该数据保存在sql server中那个字段应该是NVARCHAR

所以你保存的东西会在你找回时恢复原状。
Just use the Editor and save that data in sql server and that field should be NVARCHAR
so what you save you will get back same when you retrieve.


这篇关于如何在sqlserver中保存和检索粗体和斜体字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆