Does anyone have an idea why the following code doesn't work?
开发者_如何学JAVA SPDataSource source = new SPDataSource();
source.List = list;
source.SelectCommand = "<Query><Where><Eq><FieldRef Name='Person' LookupId='TRUE' /><Value Type='Integer'>" + currentUser.ID + "</Value></Eq></Where></Query>";
gridView.DataSource = source;
gridView.DataBind(); // <- Breaks here
Basically I am trying to filter the list for the current user and only display the items that have his name in the "Person" field. Also, it works without the SelectCommand, so I assume my query is wrong, but do not understand why it fails. I tried declaring value type as user and assigning it currentUser.Name, but it also failed.
Your error means that either your field name or datatype is invalid.
精彩评论