List:General Discussion« Previous MessageNext Message »
From:Steve Pugh Date:May 4 2004 11:00pm
Subject:Re: "INSERT INTO" dropping slashes from strings
View as plain text  
Ah!!

I was tripped up by the fact that things were fine when I was doing an 
ADO "recordset.addnew, recordset!Fieldname = variable", 
recordset.Update" kind of approach.  Switching to an INSERT query, and 
sure enough the backslashes need a little escape.

Don't we all need a little escape every now and then?

Thank you Dan!

Dan Nelson wrote:

>In the last episode (May 04), Steve Pugh said:
>  
>
>>Hello all, once again!  Can anyone tell me why the following takes
>>place?  In my VB app I am adding records to the table "Jobs" with
>>this code (trimmed way down - my actual INSERT statement populates
>>about 20 fields):
>>
>>sqlstr = "INSERT INTO Jobs VALUES(" & _
>>        Chr(34) & txtSceneFile & Chr(34) & ")"
>>
>>adocn.execute sqlstr
>>
>>Now, let's say that my txtSceneFile contains
>>"C:\Data\test\foo\bar.lws".  My Jobs table will show the following
>>for the applicable data field: "C: Data".  This, my frields, is a new
>>one to me, to be sure!  Any ideas?
>>    
>>
>
>You need to escape all quotes, apostrophes, and backslashes, or use
>bind variables and let ODBC handle the escaping for you.  Consider what
>happens with a filename like
>
>C:\temp\My "filename"'s got quotes in it.doc
>
>See http://dev.mysql.com/doc/mysql/en/String_syntax.html for more info.
>
>  
>


Thread
Multiple SELECTs in one querySteve Pugh12 Apr
RE: Multiple SELECTs in one queryVictor Pendleton12 Apr
  • Re: Multiple SELECTs in one querySteve Pugh12 Apr
  • "INSERT INTO" dropping slashes from stringsSteve Pugh5 May
    • Re: "INSERT INTO" dropping slashes from stringsDaniel Clark5 May
      • Re: "INSERT INTO" dropping slashes from stringsSteve Pugh5 May
        • Re: "INSERT INTO" dropping slashes from stringsSteve Pugh5 May
          • Re: "INSERT INTO" dropping slashes from stringsDaniel Clark5 May
            • Re: "INSERT INTO" dropping slashes from stringsSteve Pugh5 May
              • Re: "INSERT INTO" dropping slashes from stringsDaniel Clark5 May
        • Re: "INSERT INTO" dropping slashes from stringsDaniel Clark5 May
    • Re: "INSERT INTO" dropping slashes from stringsDan Nelson5 May
      • Re: "INSERT INTO" dropping slashes from stringsSteve Pugh5 May
  • Re: "INSERT INTO" dropping slashes from stringsLou Olsten8 May
Re: Multiple SELECTs in one queryUdikarni12 Apr
  • Re: Multiple SELECTs in one querySteve Pugh14 Apr
  • Re: Multiple SELECTs in one queryHarald Fuchs14 Apr
Re: Multiple SELECTs in one queryUdikarni14 Apr
  • Re: Multiple SELECTs in one queryMichael Stassen14 Apr