datatable - Illegal and exception characters in a C# DataColumn Expression -
i have rather simple situation dont have familiarity c# address.
i have datatable object returned webservice. want user able filter , analyze data create dataview object. have listbox
one of basic functions want them able searches of data. clever , add textbox , event textbox.
private void textbox1_textchanged(object sender, eventargs e) { ((dataview)listbox1.datasource).rowfilter = "mycolumn '*"+textbox1.text+"*'"; }
problem is, if user enters special characters on accident (say [ or ] or *) screw match expression. classic sql injection safety problem. problem sql blacklist characters documented (and libraries contain methods make strings sql safe because it's such common problem) "rowfilter" expression isn't sql , doesn't have documented blacklist or escape characters.
does have idea how elegantly solve problem?
all available keywords / functions quite documented: http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.71).aspx
you dont have security issues have sql injection --> work on datatable nobody can unauthorized access db. important thing have escape single quotes , additional wildcards.
Comments
Post a Comment