asp查询,没反应..

来源:百度知道 编辑:UC知道 时间:2024/06/16 00:18:42
tt=request.QueryString("tt")
exec="select * from test where tt="tt" and ff='"&ff&"'"
注:tt为时间类型
我查询的时候..比如 传递过来是 2008-4-19 ..本来应该只显示2008-4-19和符合ff='"&ff&"这个条件的数据.但我这个确把所有符合ff='"&ff&"这个条件不管是不是2008-4-19的都显示出来了.汗死..不知啥回事..高手帮忙下.!!~谢谢..

exec="select * from test where tt="tt" and ff='"&ff&"'"
改成
exec="select * from test where tt="&tt&" and ff='"&ff&"'"

同样的题。。。

exec="select * from test where tt="tt" and ff='"&ff&"'"
tt是日期,在access数据库里要加上#

exec="select * from test where tt=#"&tt&"# and ff='"&ff&"'"

最好在查询时先把[tt]转成短日期格式 date(tt)=#"&tt&"#

tt=request.QueryString("tt")
exec="select * from test where tt="tt" and ff='"&ff&"'"

改为:
tt=request.QueryString("tt")
exec="select * from test where tt='"&tt&"' and ff='"&ff&"'"

'在查询语句里表示时间的只需用''就可以了