Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replace ' and " for sql insert

Status
Not open for further replies.

anyideas

Programmer
Joined
May 2, 2002
Messages
127
Location
GB
Hi all.

I'm trying to insert into sql7 but be able to enter the chars ' ". I'm trying to do a replace but am running into problems... Can anyone see the light??

Thanks in advance

<script language=&quot;vbscript&quot;>

function clientsafeStr(inputValue)

clientsafestr=inputValue
clientsafeStr= Trim(Replace(clientsafestr,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;))
clientsafeStr= Trim(Replace(clientsafestr,&quot;'&quot;,&quot;''&quot;))

end function

</script>
 
anyideas,

What are you trying to replace?

If you have a string with a single quote and are trying to put that into a database field then you need to replace the single quote with TWO single quotes.

x = &quot;can't&quot;
if instr(x,&quot;'&quot;) > 0 then x = replace(x,&quot;'&quot;, &quot;''&quot;)


fengshui_1998
 
cheers fengshui

exactly what i wanted

mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top