开发者

Return value from database without the HTML tags?

开发者 https://www.devze.com 2022-12-16 17:21 出处:网络
In my database MYDB I have a table called MYTABLE and I have a column called Description. I am saving a long description in there with multiple HTML tags.

In my database MYDB I have a table called MYTABLE and I have a column called Description. I am saving a long description in there with multiple HTML tags.

How can i return the va开发者_开发问答lues and not include all the HTML tags?

Is this even possible? What will be the best way of doing this? In the SQL statement or in code behind? And how will I do it?


See following
Best way to strip html tags from a string in sql server?
http://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/


You are going to have to use some form of HTML parsing. If it is for basic HTML parsing then some form of Regex should suffice. However, for more advanced parsing you should look at something like HtmlAgilityPack. I use this to parse emails and I must say it works pretty well.

0

精彩评论

暂无评论...
验证码 换一张
取 消