Hi VAer-4038,
You can use "between"operator to select values within a given range in SQL.
I made a test with the following sql statement and it worked fine.
And you can modify your "sqlDelete " according to the following sql.
(The data type of the AppointmentDate field in the Test table is date)
string sql = "SELECT * FROM test WHERE Name = '" + textBox1.Text + "' And AppointmentDate BETWEEN '" + dateTimePicker1.Value.Date + "' AND '" + dateTimePicker2.Value.Date + "'";
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.