title: Filtering Data Table based on column values containing special charactors in asp.net c#
body: <p>I have below datatable which has data as shown below now i have to filter the rows based on column "Roles" which contains values like 55:1,55:2,55:3 </p>
  
  <p>Datatable look like above
  <a href="https://i.stack.imgur.com/IrxCT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IrxCT.jpg" alt="DataTable"></a></p>
  
  <p>Below is the c# code that i tried to filter but it doesnt worked</p>
  
  <pre><code>&gt; ADODB.Connection oConn = new ADODB.Connection();
  &gt;             oConn.Open("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\";", "", "", 0);
  &gt;             string strQuery = "SELECT * FROM [" + System.IO.Path.GetFileName(strFileName) + "]";
  &gt;             ADODB.Recordset rs = new ADODB.Recordset();
  &gt;             System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter();
  &gt;             DataTable dt = new DataTable();
  &gt;             rs.Open(strQuery, "Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + ";
  &gt; Extended Properties = \"Text;HDR=YES;FMT=Delimited\";",
  &gt;                 ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, 1);
  &gt;             adapter.Fill(dt, rs);
  &gt;             
  &gt;             dt.Columns[0].ColumnName = "Initial";
  &gt;             dt.Columns[1].ColumnName = "BranchCode";
  &gt;             dt.Columns[2].ColumnName = "Roles";
  &gt;             
  &gt;            
  &gt;             dt.AcceptChanges();
  &gt; 
  &gt;             //DataTable tblFiltered = dt.AsEnumerable()
  &gt;             //                 .Where(r =&gt; r.Field&lt;int&gt;("Roles") == 1)
  &gt;             //                 .CopyToDataTable();
  &gt; 
  &gt;             dt.DefaultView.RowFilter = "Roles like '%55:%'";
  &gt; 
  &gt;             return dt;
  </code></pre>