I want to query the database according to the date of data (seven), using the DataTimePicker controls, after the query to the DataGridView, the data in the table for datatime fields, accurate minutes then, desired effect is according to the start time and end time, you can query to (date) (month) (year), my statement is SQL=string, the string Format (" select * FROM X WHERE Starttime='{0}' and endtime='{1}' datatimepickerstatr. Value, datatimepickerend. Value "); SQL statements should need transformation format, do not know how, hope everybody to help to solve! Thank you
CodePudding user response:
Your SQL string printed first, and then execute the strings in SQL, look at what error, and correction with respect to ok, this is a fundamental skill in debugging,
CodePudding user response:
You print this SQL to see results, and then copy the SQL statements, get inside the database client software under test
CodePudding user response:
Datatimepickerstatr. Value. Tostring (" yyyy - MM - dd 00:00:00 ") and datatimepickerend value. Tostring (" yyyy - MM - dd 23:59:59 "), to change the date format to format, starting from zero check