sql server – display date from sql database to datetimepicker C# winform


when storing the date time from the datetimepicker to db i do this piece of code

cmd.Parameters.AddWithValues("@start_date",SqlDbType.Date).Value = txtStartDate.Value.Date;
  • the column type for start_date in sql is date
  • the format for txtStartDate in win-form is Short

so when i want to start displaying the date in the datetimepicker i do this

txtStartDate.Value = Convert.ToDateTime(myreader("start_date"));

but it is unable to display it comes up with an error saying:

“System.IndexOutOfRangeException: ‘start_date'”