Dean

Dean

  • NA
  • 3
  • 0

Selecting datarow from datatable using parameters

May 15 2013 9:38 AM

Hi all;

In a Windows form, I'm trying to select a value from a datatable like so:

DataRow[] row = Customers.Select("name = '" + this.tbName.Text + "'");


Problem is, the value in  tbName.Text can contain a string with an apostrophe, so naturally I need to escape it.  Is there any way of using a parameter in this statement to get around this problem? Something like  DataRow[] row = Customers.Select("name =  @Name"); where Name = this.tbName.Text  for example?


Answers (1)