Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Apostrophe in email address
Message
From
09/03/2018 09:15:53
 
 
To
09/03/2018 09:08:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01658635
Message ID:
01658638
Views:
54
>>Hi,
>>
>>How do you suggest to deal with a possible apostrophe in an email address (name part of the email)?
>>The code creates a SQL insert that will be executed on the server. Simplified this SQL insert looks like this:
>>
>>cSqlInsert = "INSERT INTO EMAILSEND (FROM_NAME, FROM_EMAIL, TO_EMAIL) values " + ;
>>"('" + lcSendName + "', '" + lcSenderEmail + "', '" + lcRecipientEmail + "' )"
>>
>>
>>But if the variable storing the recipient email has an apostrophe (e.g. O'Neil), the program bombs with run-time error. How do I change the lcRecipientEmail above so that it would work with any email address?
>>
>>TIA
>>
>>UPDATE. I think I just need to apply the following:
>>
>>
>>lcRecipientEmail = "'" + STRTRAN(lcRecipientEmail,['],['']) + "'"
>>
>>
>
>Yes. Your best bet is to create a routine to do this and send every string through it. After all, names can have apostrophes, too, like O'Rourke.
>
>Tamar

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform