locked
MSCRM 2011 Retrievemultiple RRS feed

  • Question

  • Hi,

        When I run this code for mscrm 2011 online version I am getting "Generic SQL error".

     

       Please help me out from this situation.

     

         
                    QueryExpression QE1 = new QueryExpression("account");

                    //Define a colum set to retrieve
                    ColumnSet ColSet1 = new ColumnSet(new string[]{"name","address1_city","emailaddress1"});
                    QE1.ColumnSet = ColSet1;

                    ConditionExpression CE1 = new ConditionExpression("address1_city", ConditionOperator.Contains , new string[] { "Hyd" });

                    QE1.Criteria.AddCondition(CE1);

                    EntityCollection EC1 = _service.RetrieveMultiple(QE1);

     

     

    Thanks

    S.B.RAju

     

     

     


    S.B.Raju
    Monday, June 20, 2011 8:05 AM

Answers

  • hi,  Jamie

     

                     Finally i got it, but it's not the way.

     

                      Insted of "ConditionOperator.Contains" when i replaced with "ConditionOperator.BeginsWith" it's working. But why it is not working with ConditionOperator.Contains condition. 

     

                     Even though it working for "Find" Option. Any guess why this happens.

     

    Thanks

    S.B.Raju

     


    S.B.Raju
    • Marked as answer by Bangar Raju Tuesday, June 21, 2011 5:23 AM
    Tuesday, June 21, 2011 4:45 AM

All replies

  • Does your user have access to read the data you are pulling?

    I usually format my retrievemultiple's the way I do it in this post:

    http://mileyja.blogspot.com/2011/05/how-to-retrieve-users-systemusers-for.html


    Jamie Miley
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Monday, June 20, 2011 11:33 AM
    Moderator
  • Hi, Jamie

     

              yes what you said is correct?.But  I want to run the above code what I have posted. It throws an error

              If you have any doubt paste the code and run it on your system.

     

     

       Thanks

    S.B.RAju

     

     


    S.B.Raju
    Monday, June 20, 2011 2:16 PM
  • But does it work my way vs yours?  I guess it's either me testing your way or you testing mine. :)
    Jamie Miley
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Monday, June 20, 2011 9:01 PM
    Moderator
  • hi,  Jamie

     

                     Finally i got it, but it's not the way.

     

                      Insted of "ConditionOperator.Contains" when i replaced with "ConditionOperator.BeginsWith" it's working. But why it is not working with ConditionOperator.Contains condition. 

     

                     Even though it working for "Find" Option. Any guess why this happens.

     

    Thanks

    S.B.Raju

     


    S.B.Raju
    • Marked as answer by Bangar Raju Tuesday, June 21, 2011 5:23 AM
    Tuesday, June 21, 2011 4:45 AM
  • It's interesting that it works with BeginsWith and not Contains. Have you checked your CRM trace file to get more verbose information on what the problem could be?

    Also, are you running Update Rollup 2? If not, this may help: http://support.microsoft.com/kb/2535245

    Tuesday, June 21, 2011 8:04 PM