You are missing some " ' ' " before and after your monthCalendar1.SelectionStart.ToString("dd/MM/yyyy")
. See below:
SqlDataAdapter Buscar = new SqlDataAdapter("SELECT ROTA, DOCA FROM Planilha4 WHERE D2 = '" + monthCalendar1.SelectionStart.ToString("dd/MM/yyyy") + "'", conexao);
Also, I would highly suggest that you parameterize your query if you have an external dependency on a control like monthCalendar1
. Here is a simple example:
string command = "SELECT ROTA, DOCA FROM Planilha4 WHERE D2 = @mnthCalendar";
sqlDA.SelectCommand.Parameters.Add(@mnthCalendar, SqlDbType.DateTime).Value = monthCalendar1.SelectionStart;