DateTime str = (DateTime)DateTime.Today.AddDays(15);
string strNewDate = str.Year + "-" + str.Month + "-" + str.Date.Day;
SPWeb currentWeb = SPContext.Current.Web;
SPList lst = currentWeb.Lists["Tasks"];
SPQuery sQuery = new
SPQuery();
sQuery.Query = "<Where><Geq><FieldRef
Name='DueDate' /><Value Type='DateTime'>"+strNewDate+"</Value></Geq></Where><OrderBy><FieldRef
Name='DueDate' /></OrderBy>";
SPListItemCollection myColl = lst.GetItems(sQuery);
if (myColl.Count > 0)
{
dgvTasks.DataSource = myColl.GetDataTable();
dgvTasks.DataBind();
}
No comments:
Post a Comment