I has a datagridview which contains information about some students, and i want to filter the data for showing only students have birthdate greater than datetimePicker1 and smaller than datetimePicker2 which were created in my form before. This is my code apply SqlDataAdapter but it not works at all:
SqlDataAdapter adap = new SqlDataAdapter("select * from Student where bdate >= '" + dateTimePicker1.Value + "' and bdate <= '" + dateTimePicker2.Value + "' ", mydb.getConnection);
DataTable table = new DataTable();
adap.Fill(table);
dataGridViewStudentList.DataSource = table;
*bdate is a column in my database that contains birthdate of students with type of Datetime. Anyone can help, thanks alot.