大家帮我看看这段代码 , 为什么不能在sql server执行
strWhere:='Where LoginDate between #'+DateToStr(dtpStart.Date)
+'# and #'+DateToStr(dtpEnd.Date)+'#';
报#出错, 这个在sql 应该用什么代替,
上面这条语句的作用是查询 在某一日期范围符合条件的记录
问题点数:20、回复次数:7Top
1 楼fredfei(飞飞)回复于 2002-04-04 16:46:30 得分 0
strWhere:='Where LoginDate between '''+DateToStr(dtpStart.Date)
+''' and '''+DateToStr(dtpEnd.Date)+'''';
sql server可以直接转换Top
2 楼vbFly(思想决定一切)回复于 2002-04-04 16:52:48 得分 0
ACCESS里才这样用Top
3 楼My_first(小@_@小)回复于 2002-04-04 16:53:09 得分 0
测试数据返回结果不对, 是不是'''写错了Top
4 楼My_first(小@_@小)回复于 2002-04-04 16:58:02 得分 0
strWhere:='Where LoginDate between '''+DateToStr(dtpStart.Date)
+''' and '''+DateToStr(dtpEnd.Date)+'''';
是不是'''写错了Top
5 楼My_first(小@_@小)回复于 2002-04-04 17:12:38 得分 0
我用查询分析器,查得的结果是 2002-04-03,
在delphi测试时 label1.caption=datetostr(date);
应该怎么处理Top
6 楼qhdsfh(飞翔的鹰)回复于 2002-04-04 17:23:39 得分 10
strWhere:='Where LoginDate between '+DateToStr(dtpStart.Date)
+''' and '''+DateToStr(dtpEnd.Date)+'''';
Top
7 楼williexu(眼镜咪)回复于 2002-04-04 17:29:46 得分 10
strWhere:='Where LoginDate between '+DateToStr(dtpStart.Date)
+''''+' and '+''''+DateToStr(dtpEnd.Date)+'''';
Top




