SPSite mySite = new SPSite(SPContext.Current.Site.ID);
SPWeb myWeb = mySite.OpenWeb();
SPList myList = myWeb.Lists["ListName"];
SPQuery query = new SPQuery();
string CurrentDate = DateTime.Now.ToString("yyyy-MM-dd");
query.Query = "<Where><Eq><FieldRef Name=\"DOB\" /><Value IncludeTimeValue=\"FALSE\" Type=\"DateTime\">" + CurrentDate + "</Value></Eq></Where>";
query.RowLimit = 10;
SPListItemCollection items = myList.GetItems(query);
DataTable dt = items.GetDataTable();
No comments:
Post a Comment