How can I get through the "'"
Collapse
This topic is closed.
X
X
-
Ivan V via DotNetMonster.comTags: None -
Cor Ligthert [MVP]
Re: How can I get through the "'" ;
Ivan,
I assume that you are not typing it directly into the SQL server, therefore
how do you do it.
In other words, what classes are you using, how does your insertstring look
like.
Cor
-
Ivan V via DotNetMonster.com
Re: How can I get through the "'" ;
Hi Cor, thanks for that reply, in my case, for instance, in a taxt box, there
is a name "INT'L" in it and i am using sql command "insert into" and that's
where my problem appeared!
Ivan
--
Message posted via http://www.dotnetmonster.com
Comment
-
Cor Ligthert [MVP]
Re: How can I get through the "'" ;
Ivan,
Therefore are the parameters.
See this sample on our website.
It is with the Fill however I assume that you can translate it to an update.
An even simpler sample is on the site with SQL.
(The datetime is used because that is mostly the most awfull one if you are
not living in the USA)
I hope this helps,
Cor
Comment
-
Ivan V via DotNetMonster.com
Re: How can I get through the "'" ;
Hi Cor, seems that's the not sample that I am looking for. By the way, thanks
a lot!
--
Message posted via http://www.dotnetmonster.com
Comment
-
Oenone
Re: How can I get through the "'" ;
Ivan V via DotNetMonster.c om wrote:[color=blue]
> I got a problem a savinf problem about my data into sql server.
> If the remarks filed include the "'" such as Chan's, Int'L, an error
> message will pop up whixh is caused by the "'", anyone knows I can
> get this through???[/color]
Replace each single-quote character with two single-quote characters in your
string, e.g.:
\\\
sql = "INSERT INTO YourTable "
sql &= "VALUES ('" & Replace(YourVal ue, "'", "''") & "')"
///
When SQL Server sees two single-quotes within a quoted string, it will
interpret them as a single single-quote within the value.
Hope that makes sense. :-)
--
(O) e n o n e
Comment
-
Ivan V via DotNetMonster.com
Re: How can I get through the "'" ;
Thanks Oenone, it works well for me now. :-)
--
Message posted via http://www.dotnetmonster.com
Comment
Comment