Basically I am using a Typed View (which is selecting from a view named ICS_COURSE_SEARCH_V). When I run sp_help on the view, the column is char(30). When I go into the LLBLGen designer, it also recognizes that the column is char(30).
We are building a "search" gui and the piece of code that adds the LIKE expression is:
switch ( exactLike )
{
case CRMConstants.CS_EXACT_MATCH:
courseSearchPredicate.PredicateExpression.AddWithAnd(new FieldCompareValuePredicate(EntityFieldFactory.Create(IcsCourseSearchVFieldIndex.CrsCde), null, ComparisonOperator.Equal, searchText ));
break;
case CRMConstants.CS_BEGINS_WITH:
courseSearchPredicate.PredicateExpression.AddWithAnd(new FieldLikePredicate(EntityFieldFactory.Create(IcsCourseSearchVFieldIndex.CrsCde), null, searchText.Trim() + "%" ));
break;
case CRMConstants.CS_ENDS_WITH:
courseSearchPredicate.PredicateExpression.AddWithAnd(new FieldLikePredicate(EntityFieldFactory.Create(IcsCourseSearchVFieldIndex.CrsCde), null, "%" + searchText.Trim() ));
break;
case CRMConstants.CS_CONTAINS:
courseSearchPredicate.PredicateExpression.AddWithAnd(new FieldLikePredicate(EntityFieldFactory.Create(IcsCourseSearchVFieldIndex.CrsCde), null, "%" + searchText.Trim() + "%" ));
break;
}
Here's the line of code that performs the fetch and utlimately creates the call to sp_executesql:
adapter.FetchTypedList(fields, courseSearchResults, courseSearchPredicate, 0, sorter, false);
Please let me know if you need more details. If you would like my email address, just let me know. Thanks again!