| |

VerySource

 Forgot password?
 Register
Search
View: 1107|Reply: 6

Strange select query, now the data will not be queried.

[Copy link]

2

Threads

18

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-2-8 23:30:01
| Show all posts |Read mode
There are select statements as below, where ... means omit some query fields.

 select AA. [ID], AA. [NO], ... AA. [Memo]
 from [Table] as AA
where AA. [CreateDate]> = '2016-12-05 00: 00: 00.000'
 and AA. [CreateDate] <= '2017-01-04 23: 59: 59.999'
 order by AA. [NO] desc

This statement was placed in VC using ADO Recordset, but it did not query any data records, but when it was placed in the query analyzer, it could query many eligible records.

Why is this?

The field CreateDate is a datetime type.When querying, I use the string method as a conditional query.
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-4-1 17:45:01
| Show all posts
This is possible in SQL. I don't understand it in VC ..
Reply

Use magic Report

2

Threads

18

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-4-2 11:15:01
| Show all posts
It is possible to write like this in VC.


You can query the data in other places like this, but this is not the only thing.
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-4-18 17:00:02
| Show all posts
No problem with SQL statement, VC will not understand
Reply

Use magic Report

3

Threads

29

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-21 00:00:01
| Show all posts
If there is a problem with the single quotes, post the code to see.
Reply

Use magic Report

0

Threads

17

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-7-1 11:15:01
| Show all posts
'2017-01-04 23:59:59.999' transformed into a time type!
Reply

Use magic Report

0

Threads

48

Posts

30.00

Credits

Newbie

Rank: 1

Credits
30.00

 China

Post time: 2020-7-1 17:00:02
| Show all posts
Use the profiler to see what the actual SQL statement is running, I think the time in the combined SQL statement is incorrect
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list