You'll have to treat it specially. Like:
const string LikeMethodName = 'like';
WhereClause += Datarow.Cells[0].Value.ToString() + " ";
string method = Datarow.Cells[1].Value.ToString();
if (method.Equals(LikeMethodName, StringComparison.OrdinalIgnoreCase))
{
WhereClause += "like '%" + Datarow.Cells[2].Value.ToString() + "%' ";
}
else
{
WhereClause += method + " " + Datarow.Cells[2].Value.ToString() + " ";
}
WhereClause += Datarow.Cells[3].Value.ToString() + " ";
SearchQuery = WhereClause;
Assuming that
all of the values you are using to construct the query are selections from lists that you define, then this is OK. If
any value going into the query is "typed-in" by the user, then this is
very vulnerable to
SQL injection attacks[
^].
In any case, instead of repeated string concatenation, I suggest using
System.Text.StringBuilder
for assembling a string from multiple pieces.