The problem is that there are a huge number of ways that you could have got this wrong!
The most obvious one is that you are storing your DateTime values in your database in a NVARCHAR column instead of a DATE or DATETIME columns, and then doing something like this:
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("SELECT dateEntered FROM myTable", con))
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
DateTime entered = (DateTime) reader["dateEntered"];
...
}
}
}
}
Because your DB column is string based, the SqlReader returns a string value, which cannot be cast to a DateTime - you would have to use DateTime.Parse or Datetime.TryParse.
But don't. Change your database to store Date based values in DateTime fields. It makes workign with them a whole lot easier...