Okay in your SP i have ignore the time portion in where condition by casting "dates" column in Date. So now your SP look like this -
ALTER PROCEDURE [dbo].[ProcedureName]
@dates Datetime
AS
BEGIN
SET NOCOUNT ON;
SELECT ID, fName, sName, dates,
COUNT(CASE TotalStaff WHEN 0 THEN 0 ELSE NULL END) AS TotalStaffs,
FROM dbo.DatabaseName WHERE CAST(dates As Date) >= CAST(@dates As Date)
GROUP BY ID, fName, sName, dates
END
and in your c# code, you have not added object in your list. So here is the modified code.
public List<ClassName> GetStaffs()
{
List<ClassName> staff = new List<ClassName>();
SqlConnection connection = new SqlConnection(ConfigurationManager.etc...);
SqlCommand mycomm = new SqlCommand("ProcedureName",connection);
mycomm.CommandType = CommandType.StoredProcedure;
mycomm.Parameters.AddWithValue("dates",DateTime.Today);
SqlDataReader reader;
connection.Open();
reader = mycomm.ExecuteReader();
while (reader.Read())
{
staff.Add(new ClassName { fName = Convert.ToString(reader["fName"]), sName = Convert.ToString(reader["sName"]), ..so-on });
}
connection.Close();
return staff;
}
Hope this will help you...