sql.Append(" and tt.DateTime >='" + DateTime.Parse(this.requestMap["DateBeg"].ToString().Trim())+ "' ");
此处this.requestMap["DateBeg"]。Tostring()接收到的是年月日(即:2011-04-11),我想在后面手工加上时、分、秒(即2011-04-11 23:59:59)这样的话,我的sql.Append该如何完整写???
此处this.requestMap["DateBeg"]。Tostring()接收到的是年月日(即:2011-04-11),我想在后面手工加上时、分、秒(即2011-04-11 23:59:59)这样的话,我的sql.Append该如何完整写???
注意:" 17:40:00"开头应有一个空格
SqlParameter par1 = new SqlParameter();
par1.DbType = System.Data.DbType.DateTime;
par1.ParameterName = "@TimePara";
par1.Value =new DateTime(year, month,day,hour,minute, second);
DateTime mydt = sql.requestMap["DateBeg"];
DateTime myt = mydt.AddSeconds(2000); 然后sql.Append(" and tt.DateTime >='" + myt+ "' ");
不行,把你那个时间转化为秒数,例如:00:10:20是620秒,再用AddSeconds方法加上
DateTime mydt = sql.requestMap["DateBeg"];
DateTime myt = mydt.AddSeconds(620); 然后sql.Append(" and tt.DateTime >='" + myt.toString()+ "' ");