我試圖顯示日期明智的數據,但我沒有得到答案准確,請幫助我..錯誤的數據顯示按日期電網明智
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();
}
什麼是錯誤?你期望什麼? – rene 2012-07-18 11:11:50
那個朋友沒有錯誤。我想顯示數據從數據庫到明智的日期到網格視圖(例如:如果我今天提交了一個數據,那麼它會在昨天或今天的標題下顯示,如明智的周,月等 – user1455232 2012-07-18 11:18:32