You can use String.Format , you need to avoid single quotes with two:
string query = string.Format("Name='{0}'", name.Replace(@"'", "''")); var rows = dt.Select(query);
or if you want to use Like :
string query = string.Format("Name LIKE '%{0}%'", name.Replace(@"'", "''"));
(note that a DataTable not vulnerable to SQL injection, since it is an object in memory)
source share