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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escape Character

Status
Not open for further replies.

dddenney

Programmer
Nov 29, 2000
41
US
Does anyone know what the escape character is for Visual FoxPro 6.0. For example when updating tables through SQL commands (Insert/Update) there might be times when we need to escape certain characters such as " and '.

Thanks in advance,

Dan
 
Hi
Can you post some of your code to enable us to help you. Your question is not clear and does not have sufficient information to help you.

The ESC character is CHR(27). YOu may want to read
SET ESC OFF and SET ESC ON
or ON ESCAPE command.
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
dddenney (Programmer)
there might be times when we need to escape certain characters such as " and '.

If you are talking about quotation marks inside the string data - surround such strings with square brackets, i.e.

[Chris "Izzy" Cole]

instead of

"Chris "Izzy" Cole"

I hope this answers your question.

Regards,

Ilya

 
This is for a web based front end. Users must be able to enter any information they want including double quotes ("), single qoute/apostrophe('), and brackets ([]) in the text area. From there we will be using the SQL Insert/Update to update tables. So that if I have a string with one or more of the above characters I need to be able to escape them in order for the query to execute properly. i.e.:

Insert into Test_Table (Descr)
Values ("This is Dan's test of the "Online" system.")

I would need to know how to escape the "" around "Online" so that the query would execute properly.
 
I know if you use ' in a string you have to double it if it is used again, eg

('This is Dan''s test of the ''Online'' system.')

Not sure of the rest I'm afraid!

Neil "I like work. It fascinates me. I can sit and look at it for hours..."
 
dddenney (Programmer)
Users must be able to enter any information they want including double quotes ("), single qoute/apostrophe('), and brackets ([]) in the text area. So that if I have a string with one or more of the above characters I need to be able to escape them in order for the query to execute properly. i.e.:

Insert into Test_Table (Descr)
Values ("This is Dan's test of the "Online" system.")

I would need to know how to escape the "" around "Online" so that the query would execute properly.

Wow - colleague!
All right, then:

1. Make square brackets "verbotten" [smile] programatically (just block them out in your KeyPress procedure for your text box for user's data entry).
2. Whatever is entered there - take it into square brackets, i.e.
Code:
lcEntry = "[" + .txtEnrty.Text + "]"
&& Makes it, as in your example, [This is Dan's test of the "Online" system.]

Insert into Test_Table (Descr) Values (lcEntry)
I hope it'll work for you.

Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top