Do I need to manually escape special characters forBindingSource.Filter?

S

Sin Jeong-hun

I have an .MDB which has a table, and let VS.NET generate all the
necessary classes for my DataGridView. Now, I want to filter the rows
on user's requests. I could simply use .Filter property, like
..Filter = "ColumnName ='%" + keyword + "%'";
But come to think of it, the keyword, which is input by users, could
contain characters like ', % or whatever special characters that the
Filter method uses. Do I need to manually escape special characters
for BindingSource.Filter? As told before I should not reinvent the
wheel, if there already is a method for this, I would like to use
that. Escaping special characters should be required for all
applications like this so I thought there probably be a method. I
tried to find a method like that would do that, but couldn't find any.
Would you please give me an advice?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top