this is doing nothing.
search is set to empty and never set to a value
string search = String.Empty;
string[] names = search.Split(',').Select(n => string.Format("'{0}'", n.Trim())).ToArray();
foreach (string v in VarinateNo)
{
search = search.Replace("\r", string.Empty);
}
search = search.Trim(',');
I suspect that instead of
search = search.Replace("\r", string.Empty);
you want
search += v.Replace("\r", string.Empty);