string _name = txtName.Text;
string _addr = txtAddr.Text;
DateTime _dof = DateTime.Parse(drpDate.SelectedValue + drpMonth.SelectedValue + drpYear.SelectedValue);
string _country = drpCountry.SelectedValue;
string _gender = rdiomf.SelectedValue;
using (SqlConnection conn = conMgr.GetDatabaseConnection())
{
using (SqlCommand cmd = new SqlCommand("insertStudent",conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@sName", _name);
cmd.Parameters.AddWithValue("@sAddress", _addr);
cmd.Parameters.AddWithValue("@sDob", _dof);
cmd.Parameters.AddWithValue("@sCountry", _country);
cmd.Parameters.AddWithValue("@sGender", _gender);
cmd.ExecuteNonQuery();
}
conn.Close();
}
该错误表示日期错误。我使用下拉框获取日期。我怎样才能解决这个问题?请帮我。我是存储过程和 asp.net 的新手