** I have a Sharepoint List called "Resources" and have various Fields as shown below and same returns as DataTable:
ID Title Role LoginName Enable[Yes/No]
1 Pranav Developer BW\PPB Yes
2 Rohit Tester BW\RW No
3 Sarang Account BW\SJ No
4 Amit Soft.Eng BW\AI Yes
4 Kunal Soft.Eng BW\KT Yes
**My code:
public static DataTable GetListData()
{
DataTable returnTable = null;
SPSite thisSite = null;
SPWeb thisWeb = null;
SPList thisList = null;
try
{
thisSite = new SPSite(siteLink);
thisWeb = thisSite.OpenWeb();
thisList = thisWeb.Lists["Resources"];
if (thisList.Items.Count > 0)
{
filterQuery = new SPQuery();
filterQuery.ViewFields = PopulateFieldsParameter("Title,Role,AddtionalRoles,Designation,LoginName,ClientBillable,NonBillable, EnableChatting,LoggedIn,EnableTimesheet,DesignationTitle,pmPODEnable");
returnTable = thisList.GetItems(filterQuery).GetDataTable();
}
returnTable = thisList.Items.GetDataTable();
}
return returnTable;
}
With this above code i am able to retrieve whole list data but i want to get table(rows) whose Enable is Yes.
Actual Output
ID Title Role LoginName Enable[Yes/No]
1 Pranav Developer BW\PPB Yes
2 Rohit Tester BW\RW No
3 Sarang Account BW\SJ No
4 Amit Soft.Eng BW\AI Yes
5 Kunal Soft.Eng BW\KT Yes
Expected Output -Condition= Enable == Yes
ID Title Role LoginName Enable[Yes/No]
1 Pranav Developer BW\PPB Yes
4 Amit Soft.Eng BW\AI Yes
5 Kunal Soft.Eng BW\KT Yes
Help..!!
thanks in advance.