illegal characters in sql?

illegal characters in sql?

am 19.01.2005 17:30:22 von Mark Mchugh

Hi,
I am getting a syntax error using the following sql
from within a visual basic project,

sqlstr = "update policies set dirs = 'z:\' where id =
2"


i cant see what is wrong, can somebody help?

thanks in advance





__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: illegal characters in sql?

am 19.01.2005 17:40:39 von Tom Crimmins

\ is an escape character. Try:
update policies set dirs = 'z:\\' where id =2


---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa


-----Original Message-----
From: Mark Mchugh
Sent: Wednesday, January 19, 2005 10:30 AM
To: mysql list
Subject: illegal characters in sql?

Hi,
I am getting a syntax error using the following sql
from within a visual basic project,

sqlstr = "update policies set dirs = 'z:\' where id =
2"


i cant see what is wrong, can somebody help?

thanks in advance

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: illegal characters in sql?

am 19.01.2005 17:42:43 von Ian Gibbons

--Alt-Boundary-7148.96625790
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

On 19 Jan 2005 at 8:30, Mark Mchugh wrote:

> Hi,
> I am getting a syntax error using the following sql
> from within a visual basic project,
>
> sqlstr = "update policies set dirs = 'z:\' where id =

The slash character is used to 'escape' other special characters.

For example if you want to insert a single quote into a string field you would use:

INSERT into table_name ( string_field) VALUES ( 'Mr O\'rielly');

See:

http://dev.mysql.com/doc/mysql/en/String_syntax.html

for more information on escape characters.

Too correct the above statement use:

sqlstr = "update policies set dirs = 'z:\\' where id =

Regards

Ian
--

--Alt-Boundary-7148.96625790--

Re: illegal characters in sql?

am 19.01.2005 17:49:10 von Annemarie Mayer

I think you have to escape the '\':

sqlstr = "update policies set dirs = 'z:\\' where id = 2"

Regards,
Anne

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re : illegal characters in sql?

am 19.01.2005 18:43:44 von Greg Quinn

Hi Mark,

I used Visual Basic as well with MYSQL, the only way I managed to escape \
and ' characters was with a function like this...

Value = Replace(Value , "'", "''")
Value = Replace(Value , "\", "\\")

Funny enough, replacing ' with \' Didn't work for me as others have
specified...

-----Original Message-----
From: Mark Mchugh
To: mysql list,
Sent: 1/19/2005 6:38:09 PM
Subject: illegal characters in sql?

Hi,
I am getting a syntax error using the following sql
from within a visual basic project,

sqlstr = "update policies set dirs = 'z:\' where id =
2"


i cant see what is wrong, can somebody help?

thanks in advance



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org