LLBLGEN 4.0
SQL 2008
In the below code, if I pass description as an empty string, it returns all records. Is there a way to return 0 records in case of empty input string ?
public static DataView ReturnSearchResult(string description)
{
try
{
Filter.Clear();
_sort = null;
var titleview = new TitleViewTypedList();
var likepredicate = new FieldLikePredicate(TitleFields.Description.SetObjectAlias("T"),
ChangeCaseClass.Uppercasestring("%" + description + "%"));
likepredicate.CaseSensitiveCollation = true;
Filter.Add(likepredicate);
Filter.AddWithAnd(new FieldCompareValuePredicate(TitleFields.Flag.SetObjectAlias("T"),
ComparisonOperator.Equal,
PublicConstantClass.Validflag));
_sort =
new SortExpression(TitleFields.Description.SetObjectAlias("T") | SortOperator.Ascending);
titleview.Fill(0, _sort, true, Filter);
return titleview.DefaultView;
}
catch (Exception ex)
{
ErrorHandlerClass.LogMessage(ex.Message + ex.StackTrace);
throw;
}
}