DataTable DataRow Select String with Quotation Marks

Posted by RBrattas on Stack Overflow See other posts from Stack Overflow or by RBrattas
Published on 2010-03-25T20:44:20Z Indexed on 2010/03/25 20:53 UTC
Read the original article Hit count: 459

Filed under:
|

Hi,

My string include quotation mark; the select statement crash.

vm_TEXT_string = "Hello 'French' People";
vm_DataTable_SELECT_string = "[MyField] = '" + vm_TEXT_string + "'";
DataRow[] o_DataRow_ARRAY_Found = vco_DataTable.Select (vm_DataTable_SELECT_string);

I cannot use this statement: string filter = "[MyColumn]" + " LIKE '%" + SearchWord + "%'";

I found string format:

DataRow[] oDataRow = oDataSet.Tables["HasDiseas"].Select ( string.Format ( "DName='{0}'", DiseasListBox.SelectedItem.ToString () ) );

Any suggestion to selecta string with quotation mark?

Thank you, Rune

© Stack Overflow or respective owner

Related posts about datatable.select

Related posts about .NET