p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

sql_language thread: single quote in SQL statement


Message #1 by mahesh.kava@p... on Wed, 27 Dec 2000 15:07:25 -0000
Replcae the single quote with two single quotes:

sSQL = Replace(sSQL, "'", "''")

The best thing to do is wrap this up in a function that does this for you, 
so you call that function with the strings you want to include in your sql 
statement instead of using Replace all the time.

HtH



At 03:39 PM 12/27/2000 -0800, you wrote:
>hi all!
>
>my sql statement is as foll:
>INSERT INTO WowWhisper(HeadLine) VALUES('" & varHeadline & "')
>
>varHeadline contains the foll string:
>'Balaji: will provide another 'kyunki' for Sony; more positives'
>
>gives me the foll error:
>Line 1: Incorrect syntax near 'kyunki'.
>(because of the single quote)
>
>how do i solve this problem.
>thanks in advance
>
>To unsubscribe send a blank email to leave-sql_language-$subst('Recip.MemberIDChar')@p2p.wrox.com



---
You are currently subscribed to sql_language as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-sql_language-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index