How to save html tags at SQL Server?

  • Thread starter Thread starter Dexter
  • Start date Start date
D

Dexter

I need to save a text with html tags in a SQL Server database. I'm using
server.htmlencode, but don't function.
A error is generate.

Somebody know how to resolve this problem?


Dexter
 
The error message is:
A potentially dangerous Request.Form value was detected from the client
(TextBox1="...imento do <b>ISS homologado</b...").


Dexter
 
1. what version of sql server
- SQL Server 2000
2. where is the error message being generated?
- A potentially dangerous Request.Form value was detected from the
client (TextBox1="...imento do <b>ISS homologado</b...").
3. what html tags are you trying to encode?
- "Data de Vencimento do <b>ISS homologado</b>"

Answer those questions and someone might be able to help you.


Dexter
 
You shouldnt have to do anything. As long as the characters, like quotes,
are escaped you should be fine.
What's the error?
 
a little more information would be helpful,

1. what version of sql server
2. where is the error message being generated?
3. what html tags are you trying to encode?
Answer those questions and someone might be able to help you.
 
Dexter,

What error is being generated? How are you currently trying to do the
insert? Are you attempting to execute a string? Are you using a stored
procedure? If you are executing a string, you may be experiencing errors
related to characters such as a single quote that interrupt the SQL string.
It would be safer for you to use the SqlCommand object and define a parameter
with a specified type such as SqlDbType.Text or SqlDbType.VarChar (depending
on your needs). Then set the parameter's value property to the HTML and give
that a shot. The SqlCommand object will make assumptions and handle some of
the data that would normally be invalid when executing a string.

Thanks,
Ian Suttle
http://www.IanSuttle.com
 
Back
Top