I having two lists for example student list and mark list. in student list i have name, class, section, address and in mark list, i have science, mathematics, geografi. In Mark list there is lookup column that reference to studentid in student list. The result of this query is gridview with information from two list. for example name, class, mathematics and geografi. i have try by using caml query but it throw some exception.
<nativehr>0x80070057</nativehr><nativestack></nativestack>
i try comment out query.projectedfields, the gridview is showing only studentid, mathematics and geografi. The information about name and adrdress is not showing. Is there something wrong with my query.projectedfields
SPQuery query = new SPQuery();
SPList customerList = Oweb.Lists["MarksMaster"];
query.Query = @"<Query><Where><Neq><FieldRef Name='ID' /><Value Type='Counter'>null</Value></Neq></Where></Query>";
query.Joins = "<Join Type='Left' ListAlias='StudentMaster'>" +
"<Eq>" +
"<FieldRef Name='StudentID' RefType='ID'/>" +
"<FieldRef List='StudentMaster' Name='ID'/>" +
"</Eq>" +
"</Join>";
query.ProjectedFields = "<field Name='Name' Type='Lookup' List='StudentMaster' ShowField='Name'/>"+"<field Name='Address' Type='Lookup' List='StudentMaster' ShowField='Address'/>";
query.ViewFields = "<FieldRef Name='Section'/>" +
"<FieldRef Name='ScienceGroup'/>";
SPListItemCollection itemCollection = customerList.GetItems(query);
int fieldCount = itemCollection.Fields.Count;
var items = itemCollection.GetDataTable();
gvCollated.DataSource = items;
gvCollated.DataBind();
Can somebody help me.