【发布时间】:2011-10-15 04:19:22
【问题描述】:
protected void Page_Load(object sender, EventArgs e)
{
string StartDate = Date3.Text;
string Enddate = Date4.Text;
ds = objBLL.GetUser(ItemType, ItemStatus);
dt = ds.Tables[0];
if (StartDate != null)
{
Filter records from datatable dt in such a way that
ParticipationStartDate > startDate");
}
if (Enddate != null)
{
Filter records from datatable dt in such a way that
ParticipationEndDate < EndDate
}
if(StartDate!=null && Enddate!= null)
{
i need to filter records from datatable such that
ParticipationStartDate > StartDate
and ParticipationEndDate < EndDate
}
}
GridView1.DataSource = dt; dt is the filtered datatable
GridView1.DataBind();
}
ParticipationStartDate,ParticipationEndDate 是数据表中的一列。 startdate 和 enddate 是 aspx 中的文本框字段。 所以这就是我想要做的。 如果 startdate(date3.text) 不为 null,则数据表应提供 ParticipationStartDate > startdate 的记录 如果 enddate(date4.text) 不为 null,则数据表应给出 ParticipationEndDate 的记录
【问题讨论】: