我想查询数据库中某一段时间范围内的数据
用了Sqlstr:= Format(' (First_Time >=''%s'') and (First_Time<=''%s'')',[DatetoStr(DateTimePicker1.Date) ,DatetoStr(DateTimePicker2.Date)])返回的有些纪录被漏掉了,为什么? 字符串比较是不是会漏掉东西!因该怎么做才不至于漏掉????谢谢!我的数据库中的时间数据存成了 yyyy-MM-dd ,是VarChar型
用了Sqlstr:= Format(' (First_Time >=''%s'') and (First_Time<=''%s'')',[DatetoStr(DateTimePicker1.Date) ,DatetoStr(DateTimePicker2.Date)])返回的有些纪录被漏掉了,为什么? 字符串比较是不是会漏掉东西!因该怎么做才不至于漏掉????谢谢!我的数据库中的时间数据存成了 yyyy-MM-dd ,是VarChar型
如果用的是ACCESS数据库,你可以用DELLPHI的功能对数据库进行查询
我下面的时间格式是yyyy-MM-dd 是ACCESS数据库
sqlstr:='select * from 操作表 where '+
'厂号='+inttostr(combobox1.ItemIndex)+' and ' +
'类型 ='+inttostr(combobox4.ItemIndex)+' and ' +
' 保存时间 like '''+trim(combobox2.Text+'-'+combobox3.Text)+'%'' order by 操作编号';
我想能够解决你的问题。
那条记录就由于2003-03-09 00:00:00:000<2003-03-09 16:20:19:000而无法显示了
//DatetoStr(DateTimePicker2.Date)不要用这个函数,用FORMATERDATETIME
请问我怎么在delphi下不能提问?