我试图按日期显示数据,但我没有得到确切的答案,请帮助我..
public void gettoday()
{
con.Open();
{
string strview = @"select MRNO,MaterialCode,Description,Specification,
Category as Cat,Source as Sor,Population as Pop, StockInStores as Stock, MRRating as Rating,PreparedBy,PreparedDate,CheckedBy,CheckedDate,ApprovedBy,ApprovedDate
from tbl_KKSMaterialRaise
where PreparedDate between (getdate()-1) and (getdate()+1)";
SqlCommand cd = new SqlCommand(strview, con);
SqlDataReader reader = cd.ExecuteReader();
GridView1.DataSource = reader;
GridView1.DataBind();
}
con.Close();
}