本帖最后由 ealzero 于 2011-03-15 16:32:30 编辑

解决方案 »

  1.   

    行26  提示--System.NullReferenceException: 未将对象引用设置到对象的实例。
      

  2.   

    this.bumen.Items[this.DropDownListNation.SelectedIndex].Text 这块是不是写错了?或者某个控件没有?
      

  3.   

    是不是你的item里面没有选中值啊
    比如你直接替换: 
    DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text
    为一个字符试试吧...
      

  4.   

    http://blog.csdn.net/itzhiren/archive/2007/05/23/1621949.aspx
      

  5.   

    八成是在这些地方DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text
    this.bumen.Items[this.DropDownListNation.SelectedIndex].Text 
    RadioButtonList2.SelectedItem.Text26行设置个断点。看看用到的值里哪个是null。
      

  6.   

    调试下下,看你26的值是不是NUll
      

  7.   

      string con="ConfigurationManager.ConnectionStrings["CarManage"].ConnectionString)";
     看一下连接获取到没,进行调试一下。
      

  8.   

    检查 using (SqlCommand command = new SqlCommand("insert into UserMessage(UserName,UPassword,UCode,UName,USex,UBir,UMZ,USFZ,UPhone,UBuMen,UAddress,UPerMissions) values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.TextBox4.Text + "','" + this.TextBox9.Text + "'," + this.RadioButtonList1.SelectedValue + ",'" + birthday.Value + "','" + DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text + "','" + this.TextBox5.Text + "','" + this.TextBox6.Text + "','" + this.bumen.Items[this.DropDownListNation.SelectedIndex].Text + "','" + this.TextBox7.Text + "','" + RadioButtonList2.SelectedItem.Text + "')"))
    里有没有空值 用断点。