DataTable.Select() if apostrophes in match-string

  • Thread starter Thread starter John Grandy
  • Start date Start date
J

John Grandy

DataTable.Select(<where clause>)

If my <where clause> is something like

WHERE Name LIKE '%Sammy's%'

then the DataTable.Select() will fail (because it sees the apostrophe in
Sammy's as ending the match-string, and doesn't know what to do with the s%'

How to get around this ?
 
Add another apostrophe to the single ones. If you google on
DataTable.Select Apostrophe - there are quite a few examples on how to deal
with it but basically you just need to use another apostrophe ''
 
Back
Top