我有个表 有两个时间字段
入住时间(intime) 和 退房时间(outtime)现在我想按时间段查询
如 两个 textbox框 第一个填开始时间
第二个填截止时间要查着两个textbox之间的时间
入住并退房的记录
咋搞啊??
select * from foom RF_Intime >=to_date(substr('" + DateTime.Parse(T_C_Time1.Text) + "00:00:00',1,10),'yyyy-MM-dd hh24:mi:ss&') and to_date(substr( '" + DateTime.Parse(T_C_Time2.Text) + "00:00:00',1,10),'yyyy-MM-dd hh24:mi:ss') <=RF_Outtime 里面绝对有记录 但这样写查不出来??
入住时间(intime) 和 退房时间(outtime)现在我想按时间段查询
如 两个 textbox框 第一个填开始时间
第二个填截止时间要查着两个textbox之间的时间
入住并退房的记录
咋搞啊??
select * from foom RF_Intime >=to_date(substr('" + DateTime.Parse(T_C_Time1.Text) + "00:00:00',1,10),'yyyy-MM-dd hh24:mi:ss&') and to_date(substr( '" + DateTime.Parse(T_C_Time2.Text) + "00:00:00',1,10),'yyyy-MM-dd hh24:mi:ss') <=RF_Outtime 里面绝对有记录 但这样写查不出来??
截取能只有十位
'yyyy-MM-dd hh24:mi:ss 明显的问题嘛substr('" + DateTime.Parse(T_C_Time1.Text) + "00:00:00',1,19)
sql_str="select * from foom RF_Intime >=to_date(substr('" + DateTime.Parse(T_C_Time1.Text) + "',1,10)"+"' 00:00:00','yyyy-MM-dd hh24:mi:ss&') and to_date(substr( '" + DateTime.Parse(T_C_Time2.Text) + "',1,10"+"' 00:00:00','yyyy-MM-dd hh24:mi:ss') <=RF_Outtime ";
TimeSpan tsp = new TimeSpan();
tsp = (DateTime.Now) - (DateTime.Parse("2010-07-01 00:00:00"));
string s = tsp.Days.ToString() + "天又" + tsp.Hours.ToString() + "小时" + tsp.Minutes.ToString() + "分" + tsp.Milliseconds.ToString() + "毫秒";要取什么时间都行