Redian新闻
>
urgent: how to compare two dates in SQL?
avatar
urgent: how to compare two dates in SQL?# Database - 数据库
S*n
1
I tried to do
"SELECT * FROM user WHERE made_time > " + login
in ASP. login is a variant, do I need single quote?
Error message:
Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
criteria expression.
What's wrong?
avatar
w*h
2
What's the data type of your made_time? Andwhat's the format
of "login"? They have to be consistent.

【在 S****n 的大作中提到】
: I tried to do
: "SELECT * FROM user WHERE made_time > " + login
: in ASP. login is a variant, do I need single quote?
: Error message:
: Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
: criteria expression.
: What's wrong?

avatar
i*s
3
Use cdate() change login to data type

【在 S****n 的大作中提到】
: I tried to do
: "SELECT * FROM user WHERE made_time > " + login
: in ASP. login is a variant, do I need single quote?
: Error message:
: Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
: criteria expression.
: What's wrong?

avatar
w*n
4
Or, simply use SYSDate instead of 'login'.
I think it can also works.

【在 S****n 的大作中提到】
: I tried to do
: "SELECT * FROM user WHERE made_time > " + login
: in ASP. login is a variant, do I need single quote?
: Error message:
: Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
: criteria expression.
: What's wrong?

avatar
b*e
5
if login is a date variable that is specified by user at
runtime.. you should make sure you add ' ' around login
in the variable itself.. then construct your sql.

【在 w*********n 的大作中提到】
: Or, simply use SYSDate instead of 'login'.
: I think it can also works.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。