查询两个日期之间的搜索 [英] Query to search between two dates

查看:75
本文介绍了查询两个日期之间的搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个访问数据库,并创建了一个名为RECORDS

的表格,其中包含以下字段


cust_name ......(客户)名称)

物品..............(物品)

date_pur ..........(购买日期) )

cmp_name ......(公司名称)


现在我有一个表格我通过它输入2个日期

date_from

date_to


i将这些值放到另一个asp页面上,我想搜索这两个日期之间的所有记录并显示他们我不知道要执行查询plz plz plz plz如果any1可以帮助我:(

i am having an access database and have created a table named RECORDS
which has the following fields

cust_name......(customer name)
items..............(items)
date_pur..........(purchase date)
cmp_name......(company name)

Now i have a form through which i input 2 dates

date_from
date_to

i get these values onto another asp page and i want to search all the records that are between these 2 dates and display them i have no idea for the query to be executed plz plz plz plz if any1 could help me:(

推荐答案

我对ASP一无所知。

如果你只是想要一个查询来完成一份工作,请告诉我。
I know nothing about ASP.
If you just want a query to do a job then let me know.


yes先生目前我的查询是

" SELECT * from table_name where field_name> =''"& date_from&"''AND field_name< =''"& date_to&" "


中的数据类型提交"数据库; date_pur"是文本我尝试过其他查询包括关键字BETWEEN但是当我输入日期时没有一个给我确切的结果

date_from = 1/1/2006(mm / dd / yyyy)

date_to = 8/2/2006(mm / dd / yyyy)


它检索到正确的结果,但每当我在日期或月份切换到两位数时例如我输入日期

date_from = 1/12/2006

date_to = 1/22/2006


它给出了我的日期甚至小于date_from如果你可以引导我plz doo,那就不是必需的了:(我在aloot mess


tahnks提前aloot
yes sir currently my query is
"SELECT * from table_name where field_name>= ''"& date_from &"'' AND field_name <=''"& date_to &"'' "

the datatype for the database filed "date_pur" is text i have tried other queries includin the keyword BETWEEN but none of it is giving me the exact results,when i input the dates
date_from=1/1/2006(mm/dd/yyyy)
date_to=8/2/2006(mm/dd/yyyy)

it retrieves correct results but whenever i switch to double figures in the date or month section for example i input the dates
date_from=1/12/2006
date_to=1/22/2006

it gives me the dates that are even smaller than the "date_from" which is not required plz if u can guide me plz doo :( im in aloot mess

tahnks aloot in advance

我对ASP一无所知。

如果你只是想要一个查询来做一份工作然后让我知道。
I know nothing about ASP.
If you just want a query to do a job then let me know.


我们可以帮助。

你的SQL不对。

[Field_Name]的字段类型是什么?

Date_From&的变量类型是什么? ; Date_To?

如何将数据放入Date_From& Date_To?

你需要使用Format()函数,但我不知道究竟是怎么做的没有这些问题的答案。
We can help.
Your SQL is not right.
What is the field type of [Field_Name]?
What is the variable type of Date_From & Date_To?
How is the data put into Date_From & Date_To?
You will need to use the Format() function, but I won''t know exactly how without answers to these questions.


这篇关于查询两个日期之间的搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆