I would like to search record by two dates, the two dates will be selected by a user via calendar. This is how I wrote the query:
public List<Staff> GetStaff(DateTime DateOne, DateTime DateTwo, string staffColourCode)
List<Staff> l= new List<Staff>();
SqlConnection conn = new connection etc...
SqlCommand command = new SqlCommand("SELECT * FROM TableName WHERE CAST(Time AS date) BETWEEN @Time and @Time", conn);
SqlDataReader reader = command.ExecuteReader();
Staff s= new Staff();
In my database if i replace Time with some date then it works but how do i write a query that allows a users to select two dates and based on DateOne and DateTwo search the list of Staff who has a colour code of whatever a user selects e.g. Green, Yellow etc...