CAML Query Syntax - More than 2 parameters - InfoPath Dev
in

InfoPath Dev

CAML Query Syntax - More than 2 parameters

Last post 10-01-2008 12:21 PM by cbodary. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-01-2008 11:57 AM

    CAML Query Syntax - More than 2 parameters

    I have created a custom webpart that utilizes a series of Drop Downs to filter data (AJAX), and then uses the string created from the "selected values" in the dropdowns (CAML Query) to bind data to a DataGrid control.  Where I'm struggling is with the CAML query, because I have more than two parameters/filters in the select command.  Can someone answer two questions, for me:

    1.) Is the syntax in the following query correct?

    2.) If it is correct, why won't the code bind the data to the datagrid like it's supposed to?  When I execute this code in the web part, I receive a message stating "One or more field types are not installed properly.  Go to the list settings page to delete these fields."  I have verified that the field types in the lists in question are correct.

     void bindDataGrid()
            {
                //lblMessage.Text = "";
                try
                {
                    string selectedPhaseGate = ddItemsListNames.SelectedValue.ToString();
                    spDS.List = site.Lists[selectedPhaseGate];
                    spDS.SelectCommand = "<Query><Where><And><And><Eq><FieldRef Name='ProgramName'/><Value Type='Text'>" + ddProgramNames.SelectedValue.ToString() + "</Value></Eq><Eq><FieldRef Name='Customer'/><Value Type='Text'>" + ddCustomers.SelectedValue.ToString() + "</Value></Eq></And><Eq><FieldRef Name='EndItem'/><Value Type='Text'>" + ddEndItems.SelectedValue.ToString() + "</Value></Eq></And></Where></Query>";

                    oGrid.DataSource = spDS;

                    this.oGrid.DataBind();
                    if (oGrid.Rows.Count > 0)
                    {
                        if (this.oGrid.HeaderRow.Cells[7].Style.Value == null)
                        {
                            for (int x = 7; x < numCols + 3; x++)
                            {
                                this.oGrid.HeaderRow.Cells[x].Style.Value = "writing-mode: tb-rl; filter: FlipH FlipV;";
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = ex.Message;
                }
            }

     

    Thank you.

  • 10-01-2008 12:21 PM In reply to

    Re: CAML Query Syntax - More than 2 parameters

    I have answered both of these questions myself.  I should have known that by publishing my pains the answers would come to me shortly thereafter.

     1.) Yes, the syntax is perfect.
     2.) Don't EVER rename the default 'Title' column in a SharePoint List again.  :)

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.