更新前
更新中
更新后
问题:
部分代码:
string p_teacher = ((DropDownList)DetailsView1.FindControl("DropDownList1")).SelectedValue;//教师
string p_teacherid = ((DropDownList)DetailsView1.FindControl("DropDownList2")).SelectedValue;//教师编号
string p_score = ((DropDownList)DetailsView1.FindControl("DropDownList4")).SelectedValue;//学分
string p_department = ((DropDownList)DetailsView1.FindControl("DropDownList3")).SelectedValue;//所属系别
db sdb = new db();
string qq = "update programme set p_programmeid='" + p_programmeid + "',p_programme='" + p_programme + "',p_time='" + p_time + "',p_place='" + p_place + "',p_type='" + p_type + "',p_restrict='" + p_restrict + "',p_quota='" + p_quota + "',p_attribute='" + p_attribute + "',p_content='" + p_content + "',p_teacher='" + p_teacher + "',p_teacherid='" + p_teacherid + "',p_score='" + p_score + "',p_department='" + p_department + "'where p_id='" + p_id.ToString() + "'";
if (sdb.enq(qq) > 0)
{
Response.Write("11");
DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
}
else
{
Response.Write("22");
}
}
除了教师编号的SelectedValue为null外,其它三个都有值~而且可以更新~
为什么教师编号的SelectedValue为null呢?
....
再把过程详细一点~免得等不到答案~
这是模版里的~我把教师和教师名称都放在教师的模版里面(如果分开放的话,那这两个就作不成联动了~~)
再来几个图