RE: How to save html tags at SQL Server?

From: Ian Suttle (IanSuttle_at_discussions.microsoft.com)
Date: 12/10/04


Date: Fri, 10 Dec 2004 12:07:05 -0800

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

"Dexter" wrote:

> 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
>
>
>



Relevant Pages

  • Re: How to find the startup directory of my program?
    ... * Utility class to get String and File reference to the local directory ... public class LocalDir ... * Returns the disk file name of the class that is executing. ... * Returns the name of the local directory based on the results of a call ...
    (comp.lang.java.programmer)
  • Help DLL calling in Excel 2007 crashes
    ... functions calls a function in a DLL and when that DLL function returns, ... VBA continues executing by starting the same VBA function over. ... ByRef szCompany As String, ByRef szCode As String) As Long ...
    (microsoft.public.excel.programming)
  • Re: Insert Data
    ... This is my function for executing UPDATE, ... You just supply the SQL statement and the connection ... Public Function ExecDB(ByVal ExecuteQuery As String, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Weird Error Msg
    ... I am working on file and string searching. ... while executing my code, i ... am getting this strange error msg. ... You should probably be using the "glob" command, but I'm guessing you're not since the "list" of files you are iterating over isn't a valid list. ...
    (comp.lang.tcl)
  • Re: Newbie Problem using if statement with &&
    ... >> John wrote: ... >>> string of 1 or 0 depending on what im sending. ...  > Yeah I have tested the vslues and they are valid. ...
    (comp.lang.php)