As my tiltle clearly mentions I am trying to filter the datatable with a filter text having single quote in it .
My statement is as follows
dgURComments.ItemsSource).ToTable().Select("URComments = '" + txtComments.Text.Trim() + "'");
How can I overcome from this ?
Instead of fiddling around with
DataTable.Selecti would useLinq-To-DataSet:If you need a DataTable from the filtered result, you can use
CopyToDataTableThe minimum requirement is a reference to
System.Core.dlland a using directive forSystem.Linq. By default, these are supplied if you create a new Visual C# 2008 project.LINQ to DataSetalso requires a reference toSystem.Data.dllandSystem.Data.DataSetExtensions.dlland an using directive.