|
 |
asp_databases thread: insert statement issues
Message #1 by "Brian Ware" <brianw@d...> on Thu, 3 Jan 2002 21:55:38
|
|
trying to insert a text area with special characters in it, such as an
apostrophy. keep getting an error unless i change the text from ' to
´ not really wanting to do that. is there a good way to force this
insert or to validate the text prior to input?
thanks,
brian
Message #2 by "Peter Foti (PeterF)" <PeterF@S...> on Thu, 3 Jan 2002 17:07:47 -0500
|
|
In your string, replace the single apostrophy with 2 of them.
Function sql_quote(str)
str = replace(str,"'","''")
sql_quote = "'"& str & "'"
End Function
So you could do this:
MySQL = "INSERT INTO " & tablename & " (" & fieldname & ") VALUES (" &
sql_quote(Request("MyFormItem")) & ")"
> -----Original Message-----
> From: Brian Ware [mailto:brianw@d...]
> Sent: Thursday, January 03, 2002 9:56 PM
> To: ASP Databases
> Subject: [asp_databases] insert statement issues
>
>
> trying to insert a text area with special characters in it,
> such as an
> apostrophy. keep getting an error unless i change the text from ' to
> ´ not really wanting to do that. is there a good way
> to force this
> insert or to validate the text prior to input?
>
> thanks,
> brian
> $subst('Email.Unsub').
>
Message #3 by "Brian Ware" <brianw@d...> on Thu, 3 Jan 2002 23:45:43
|
|
Thank you for the answer. Quite easy, and effective. Thanks.
> In your string, replace the single apostrophy with 2 of them.
>
> Function sql_quote(str)
> str = replace(str,"'","''")
> sql_quote = "'"& str & "'"
> End Function
>
> So you could do this:
>
> MySQL = "INSERT INTO " & tablename & " (" & fieldname & ") VALUES (" &
> sql_quote(Request("MyFormItem")) & ")"
>
Message #4 by "Tomm Matthis" <matthis@b...> on Fri, 4 Jan 2002 09:11:48 -0500
|
|
You can escape the string (that is "double up" the back-ticks) or move to
command objects and they will handle the delimiters for you automatically.
-- Tomm
> -----Original Message-----
> From: Brian Ware [mailto:brianw@d...]
> Sent: Thursday, January 03, 2002 9:56 PM
> To: ASP Databases
> Subject: [asp_databases] insert statement issues
>
>
> trying to insert a text area with special characters in it, such as an
> apostrophy. keep getting an error unless i change the text from ' to
> ´ not really wanting to do that. is there a good way to force this
> insert or to validate the text prior to input?
>
> thanks,
> brian
> $subst('Email.Unsub').
>
|
|
 |