Post by Manoj KumarThanks for your reply.
But the case is different. When try to insert a paragraph into
sqlserver database say supposet
string query="insert into tables values('"&name&"','"¶graph"&')"
execute query
if the variable paragraph contains single quotes or double quotes, then it show the error.
I can see why single quotes would raise an error, but why double quotes? Are
you sure they are causing a problem? They certainly would not be causing a
problem with the database engine.
In any case, that's why you need to use parameters instead of dynamic sql.
What language is that? You'll need to ask in a forum or newsgroup focussed
on that language how to pass values to parameterized sql statements. It's
certainly possible in .Net and older versions of VB.
An alternative to using parameters is to escape the characters by doubling
them before concatenating them into your string. Here is what would be done
in vb/vbscript:
name = replace(name,"'", "''")
paragraph=replace(paragraph,"'","''")
query="insert into tables values('"&name&"','"¶graph"&')"
For the solution related to your programming language, you need to find a
forum or newsgroup focussed on that language.