Search for Single Quote in DataTable

  • Thread starter Thread starter john pp nn
  • Start date Start date
J

john pp nn

Guest
Hi folks,


In my WinForms app, I have a textbox.

When someone begins to type into the textbox, my program begins to search a dataTable for the text entered. Here is my code:


txtSearchString.Text = "'Text" // inc single Quote

DataRow[] foundRow;
string searchString = txtSearchString.text;
searchString = searchString.Replace("'", @"\\'") // does NOT work
foundRow = _dsStock.Tables[0].Select("ID = '" + searchString + "'"); // Error The expression contains an invalid string '\\''

Any ideas ?


John




jppnn

Continue reading...
 
Back
Top