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