日期:2014-05-17  浏览次数:20979 次

运行这个后台代码时总是报错,提示第17行未将未将对象引用设置到对象的实例。求大牛帮忙解答!!!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ProjectApplication.BLL;
using System.Data.SqlClient;

namespace ProjectApplication.DeptReview
{
    public partial class TeacherInfo : System.Web.UI.Page
    {
        BLL.ApplicatorInfo applicator = new ApplicatorInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlDataReader dr = applicator.GetAppInfo(Session["ID"].ToString());
            AppId.Value = Session["ID"].ToString();
            while (dr.Read())
            {
                AppName.Value = dr[0].ToString();
                DropDownList1.SelectedValue = dr[1].ToString();
                DropDownList2.SelectedValue = dr[2].ToString();
                DropDownList3.SelectedValue = dr[3].ToString();
                AppEmail.Value = dr[4].ToString();
                AppPassword.Value = dr[5].ToString();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            BLL.ApplicatorInfo applicator = new ApplicatorInfo();
            Model.ApplicatorInfo model_applicator = new Model.ApplicatorInfo();
            model_applicator.AppName = AppName.Value;
            model_applicator.AppSex = DropDownList1.SelectedValue;
            model_applicator.AppPosition = DropDownList2.SelectedValue;
            model_applicator.AppDept = DropDownList3.SelectedValue;
            model_applicator.AppEmail = AppEmail.Value;
            model_applicator.AppTel = AppTel.Value;//新加入的字段,还未修改数据库(但是添加了字段存根)
            model_applicator.AppPassword = AppPassword.Value;
   &nbs