| |

VerySource

 Forgot password?
 Register
Search
View: 2332|Reply: 13

ACCESS time query ...

[Copy link]

2

Threads

17

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-2-4 16:30:01
| Show all posts |Read mode
I have a time field in my access
Data type is date / time
How do I write SQL statements in my ADO queries ???
And the query date type entered by my edit box is CString
So how do you combine them for querying?
Thank you
Reply

Use magic Report

2

Threads

17

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-3-24 21:30:02
| Show all posts
Isn't it so troublesome / .1 / ...?
Reply

Use magic Report

2

Threads

17

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-3-30 13:15:01
| Show all posts
Did I not explain it?
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-31 20:30:01
| Show all posts
CString strSQL;
strSQL.Format ("Select * From TableName where TableName.DateType = # 2017-1-4 #");
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

Post time: 2020-4-1 07:30:01
| Show all posts
The example assumes that there is a table named TableName in the database.
The TableName table has a field of type DateType,
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-4-1 17:30:01
| Show all posts
strSQL.Format ("SELECT * FROM table WHERE column = '% s'", CString)
Reply

Use magic Report

2

Threads

17

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-4-3 07:30:01
| Show all posts
I entered it as CString!
Tip Data does not match
My database is date type!
The string can't be found at all.
For example: I entered 2002-2-1 and it was wrong!
Do you have to convert ?!
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-4-3 20:00:02
| Show all posts
CString strTime = "2002-2-1";
CString strSQL;
strSQL.Foramt (SELECT * FROM table (table name) WHERE column (column name) = '% s' ", strTime);
pRs-> Open ((_ bstr_t) strSQL, ...);
Reply

Use magic Report

2

Threads

17

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-4-4 02:30:01
| Show all posts
It is exactly what I have done
Error message:
Standard expression city data types do not match!
????
I think you checked it according to the string
Reply

Use magic Report

2

Threads

17

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-7-23 11:45:01
| Show all posts
Is that right?
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