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)
 Updating fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-18 : 09:08:34
Tomas writes "Hi!
I have a problem that I don't think is related to any specific database.
When Using a SQL-statement like:
UPDATE table SET field = something WHERE ....
everything works fine until the "something" is containing for exampel a whole webpage, retrieved from an ASP-page with <TEXTAREA>-statement.
Then I write in the ASP-code
sql="UPDATE table SET field='" & Request.Form("page") & "' WHERE..."
Since it is most likely that the page will contain signs like ", ', ;, the whole sql-statement is not interpreted right and I get an error.

Do You know how to solve this problem??

//Tomas"

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-06-18 : 11:19:20
I used to replace the double quotes with single quotes,
then replace the single quotes with two single quotes.
I don't remember any difficulty with the semi-colon.

Also, if you are using SQL Server have a look in BOL for QUOTENAME

HTH
Go to Top of Page
   

- Advertisement -