如何在sql server数据库中保存html标签? [英] How to save html tags in sql server database?

查看:77
本文介绍了如何在sql server数据库中保存html标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在sql server数据库中保存html标签?如果我想将HTML文本保存到数据库,我该怎么办?

How to save html tags in sql server database? If i want to save HTML text to database, how can i do that?

推荐答案

参考此链接





http://stackoverflow.com/ questions / 7759329 / how-to-save-html-content-in-database [ ^ ]


您可以使用HtmlEncode()和HtmlDecode()方法转换数据之前保存和检索数据。



You can use the the HtmlEncode() and HtmlDecode() methods to convert the data before saving and retrieving data.

// Encode the content for storing in Sql server.
string htmlEncoded = WebUtility.HtmlEncode(text); 

// Decode the content for showing on Web page.
string original = WebUtility.HtmlDecode(htmlEncoded);


这篇关于如何在sql server数据库中保存html标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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