Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Storing HTML syntax in Text field

Author  Topic 

kirkeby
Yak Posting Veteran

57 Posts

Posted - 2002-07-25 : 09:35:15
First, I have searched and read everything I can find that might be related to this problem.

I have an Articles table: ID int 4, Title varchar 50, Content text, ArticleDate smalldatetime, Author varchar 50

If, for example, I type in content into the Content field, including line returns, etc., when I display it via an ASP page, it all runs together. If I modify that content to include HTML then the formatting when viewed is correct. Ok, that part is fine. The trouble comes in when I need to input an article that contains HTML syntax as part of the article. In other words, the HTML should NOT be executed, simply shown as part of the article. I hope that makes sense.

How do I do this? What do I do to make SQL not convert HTML tags? Is there something in the configuration of the SQL server that needs to be done? Thanks for any help! I'm struggling with this one.

kirkeby
Yak Posting Veteran

57 Posts

Posted - 2002-07-25 : 09:36:53
Forgot to mention, SQL 7.0, OS NT 4

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-25 : 09:43:23
Take a look at the ASP Server object, it has methods for HTML and URL encoding/escaping:

myString=Server.HTMLEncode(request.form("content"))

You would then pass myString to SQL Server instead of the request("content") value.

For more info take a look at these ASP sites:

www.4guysfromrolla.com
www.15seconds.com
www.asp101.com
www.aspalliance.com
www.learnasp.com

Go to Top of Page

kirkeby
Yak Posting Veteran

57 Posts

Posted - 2002-07-25 : 13:16:19
Thanks for the response. I looked into it but in the end decided to do something different. I simply put an IFRAME tag in the content field that points to an external .txt or .doc file that contains the article. This way, all formatting is maintained and for our use, the response time is very fast. Works well for now. Thanks again!

Lisa Kirkeby
BP
kirkeblm@bp.com
SQL 7.0, NT 4.0 (1381), CP 1252
Go to Top of Page
   

- Advertisement -