c# - Trouble with single quotes in Select expression -
this question has answer here:
the code pretty simple:
string expression = "user = '" + user.username + "'"; int selectioncount = data.select(expression).count(); it works fine until user.username doesn't contain single quote '. example, if user.username equal "gul'mirka" app crashes. how fix this?
actually user.username can contain anything, numbers (7548375982) or mathematical equations (1 + x = 4).
thank you!
escape single quotes:
string expression = "user = \'" + user.username + "\'"; int selectioncount = data.select(expression).count();
Comments
Post a Comment