|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Update command and sigle quotes
<i><b>Originally posted by : RG (rgonzales66@attbi.com)</b></i><br />what do I need to escape single quotes in side of a request record set here is the SQL statment I am using but a tick inside of any of the filds causes a error "Syntax error (missing operator) in query expression" ... of corse if you use two single quotes it will update the record<br /><br />SQLstmt = "UPDATE articles SET "_<br />& "title = '" & request("title") & "', " _<br />& "body = '" & request("body") & "', " _<br />& "blurb = '" & request("blurb") & "', " _<br />& "author = '" & request("author") & "' " _<br />& "WHERE (id = " & ID & ")"<br /><br />Set rs = conn.execute(SQLstmt)<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Paolo Marini (the_hobbit30@hotmail.com)</b></i><br />Just substitute every<br />Request("field")<br />with<br />Replace(Request("field"), "'", "''")<br /><br />Bye<br /><br /><br />------------<br />RG at 5/26/2002 10:59:16 AM<br /><br />what do I need to escape single quotes in side of a request record set here is the SQL statment I am using but a tick inside of any of the filds causes a error "Syntax error (missing operator) in query expression" ... of corse if you use two single quotes it will update the record<br /><br />SQLstmt = "UPDATE articles SET "_<br />& "title = '" & request("title") & "', " _<br />& "body = '" & request("body") & "', " _<br />& "blurb = '" & request("blurb") & "', " _<br />& "author = '" & request("author") & "' " _<br />& "WHERE (id = " & ID & ")"<br /><br />Set rs = conn.execute(SQLstmt)<br />
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : Paolo Marini (the_hobbit30@hotmail.com)</b></i><br />It's not so readable...<br />The second parameter for the Replace function is "'", that is a single quote.<br />The third parameter is a "''", that is a single quote repeated twice.<br /><br /><br />------------<br />Paolo Marini at 5/28/2002 4:29:37 PM<br /><br />Just substitute every<br />Request("field")<br />with<br />Replace(Request("field"), "'", "''")<br /><br />Bye<br /><br /><br />------------<br />RG at 5/26/2002 10:59:16 AM<br /><br />what do I need to escape single quotes in side of a request record set here is the SQL statment I am using but a tick inside of any of the filds causes a error "Syntax error (missing operator) in query expression" ... of corse if you use two single quotes it will update the record<br /><br />SQLstmt = "UPDATE articles SET "_<br />& "title = '" & request("title") & "', " _<br />& "body = '" & request("body") & "', " _<br />& "blurb = '" & request("blurb") & "', " _<br />& "author = '" & request("author") & "' " _<br />& "WHERE (id = " & ID & ")"<br /><br />Set rs = conn.execute(SQLstmt)<br />
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Update command and sigle quotes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|