Home > Software engineering >  MFC how to query the database content by date
MFC how to query the database content by date

Time:10-21

MFC how to query the database content, through the date stored in the data in the record date, want to query the date time to display the query results, try for a long time didn't also set, do you have any good Suggestions?

CodePudding user response:

Date fields & gt;=# 2016-06-14 00:00:00 # AND date fields & lt;=# 23:59:59 # 2016-06-14

CodePudding user response:

Thank you, you can use, adopted two time controls, how to replace the time constant in the # 2016-06-14 #, to query any time of the data

CodePudding user response:

 
Cstrings cstrSQL;
CstrSQL. Format (" SELECT * FROM table name WHERE date field & gt;=# % s 00:00:00 # AND date fields & lt;=23:59:59 # # % s ", cstrBeginDate, cstrEndDate);

CodePudding user response:

Controls associated words can DDX_DateTimeCtrl date CTime variable
CTime by Format function, time can be formatted into string
Such as cstrings s=tm. The Format (_T (" % % Y - m - H: % d % % m: % s "))

CodePudding user response:

SQL statements,
  • Related