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

datacolumn.expression with apostrophe in string 1

Status
Not open for further replies.

SavantMan

Programmer
Apr 17, 2002
165
US
I have a need to set the expression of a datacolumn to calculate based on another field, plus a string. The problem is if that string contains an apostrophe, it's recognized as a a single quote.

ie:
Code:
   Dim c As New DataColumn
   c.Expression = "[UserName] & ' is users name'" <-- works fine
   c.Expression = "[UserName] & ' is user's name'" <-- doesn't work

The problem in the second line is the apostrophe is being recognized as closing the literal string.
 
Have you tried doubling the apostrophe as in?:

[tt]c.Expression = "[UserName] & ' is user''s name'"[/tt]


Hope this helps

[vampire][bat]
 
That's exactly what I needed --- thanks - here's a star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top