| Author |
How to ignore " in a string
|
|
| Ian Davies 2006-04-27, 6:56 pm |
| I have the following sql string to run as a command in my VB6 project
strSQL = "LOAD DATA INFILE " & ImportFile & " INTO TABLE tPupils FIELDS
TERMINATED BY ',' ENCLOSED BY ' " ' LINES TERMINATED BY '\n';"
Problem is the double quote at position ......" ' LINES......
the command to fail thinking the double quote is ending the SQL but it is
infact just indicating that the file being read in has fields enclosed by "
How do I rewrite this string so I can use the double quote in it as part of
the string and not to terminate it
Thanks
ps the sql is to update a mysql table
| |
| Bob Butler 2006-04-27, 6:56 pm |
| "Ian Davies" <iandan.dav@virgin.net> wrote in message
news:tq84g.3527$ZB4.3406@newsfe7-win.ntli.net
> I have the following sql string to run as a command in my VB6 project
>
> strSQL = "LOAD DATA INFILE " & ImportFile & " INTO TABLE tPupils
> FIELDS TERMINATED BY ',' ENCLOSED BY ' " ' LINES TERMINATED BY '\n';"
....ENCLOSED BY ' "" ' LINES ...
or
....ENCLOSED BY ' " & Chr$(34) & " ' LINES ...
--
Reply to the group so all can participate
VB.Net: "Fool me once..."
| |
| Ian Davies 2006-04-27, 6:56 pm |
| Thanks
That solved that problem
Still not working though. Error message indicating a syntax error. I think
it is something to do with a variation thats needed somewhere due to the use
of mysql.
Will post again if I cant resolve it.
Thanks again
Ian
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:O8LhyyiaGHA.996@TK2MSFTNGP04.phx.gbl...
> "Ian Davies" <iandan.dav@virgin.net> wrote in message
> news:tq84g.3527$ZB4.3406@newsfe7-win.ntli.net
>
>
> ...ENCLOSED BY ' "" ' LINES ...
>
> or
>
> ...ENCLOSED BY ' " & Chr$(34) & " ' LINES ...
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
| |
| Jim Carlock 2006-04-27, 6:56 pm |
| "Ian Davies" <iandan.dav@virgin.net> wrote:
> That solved that problem
> Still not working though. Error message indicating a
> syntax error. I think it is something to do with a variation
> thats needed somewhere due to the use of mysql.
> Will post again if I cant resolve it.
Try removing the spaces around the apostrophe?
Public Const vbQM As String = """"
sSQL = "LOAD DATA INFILE " & vbQM & ImportFile & _
vbQM & " INTO TABLE tPupils FIELDS TERMINATED " &
"BY ',' ENCLOSED BY '" & vbQM & "' LINES " & _
"TERMINATED BY '\n';"
Jim Carlock
Post replies to the group.
--
Swimming Pool Builders http://www.aquaticcreationsnc.com/
|
|
|
|