//你好!每当我尝试使用 DatePicker 插入日期时,我都会遇到问题
DateTime birth_date=Convert.ToDateTime(datePickerEBirthDate.SelectedDate);
SqlConnection SQLconnection = new SqlConnection(@"Server=MyMachineName\SQLEXPRESS;Database=MyDataBase;Integrated Security=SSPI");
SqlCommand command = SQLconnection.CreateCommand();
SQLconnection.Open();
command.CommandText = "INSERT INTO courses " +
"(name, birthdate) VALUES " +
"(@name, @birthdate)";
command.Parameters.AddWithValue("@name", txtName.Text);
command.Parameters.AddWithValue("@birthdate", birth_date);
command.ExecuteNonQuery();
SQLconnection.Close();
//这是错误信息