I cant use LIKE predicate into TypedList!

Posts   
 
    
Posts: 14
Joined: 09-Sep-2007
# Posted on: 21-Nov-2007 15:08:55   

This code is filtering but i want using like!Im using TypedList. Could you help me! IPredicateExpression Filter = new PredicateExpression();

       if (txtCompanyName.Text != "")
        {
            Filter.Add(CustomerFields.Name % txtCompanyName.Text );
        }
        if (txtName.Text != "")
        {
            Filter.Add(ContactFields.Firstname % txtName.Text);
        }
        if (txtSurname.Text != "")
        {
            Filter.Add(ContactFields.Lastname % txtSurname.Text);
        }
        if (txtTel.Text != "")
        {
            Filter.Add(ContactFields.WorkPhone % txtTel.Text);
        }
  ISortExpression Sort = new SortExpression();

    Sort.Add(CustomerFields.Name | SortOperator.Ascending);

    ds_Customers.FilterToUse = Filter;
    ds_Customers.SorterToUse = Sort;
    ds_Customers.Refetch = true;
    ds_Customers.DataBind();
    dgCustomer.DataBind();
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Nov-2007 15:18:06   

I don't understand your question % == LIKE

You are already using like.

Posts: 14
Joined: 09-Sep-2007
# Posted on: 21-Nov-2007 15:33:56   

I use Like but its not working when i am using TypeList if i use Collection this code doing what i wanna do

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Nov-2007 15:49:54   

Please examine and post the generated SQL query when you use a TypedList. And try to run the SQL Query manually against the database to see what's going wrong.

For know how about capturing the generated query please consult the manual's section: "Using the generated code -> Troubleshooting and debugging"