未将对象引用设置到对象的实例?? 本帖最后由 ealzero 于 2011-03-15 16:32:30 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 行26 提示--System.NullReferenceException: 未将对象引用设置到对象的实例。 this.bumen.Items[this.DropDownListNation.SelectedIndex].Text 这块是不是写错了?或者某个控件没有? 是不是你的item里面没有选中值啊比如你直接替换: DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text为一个字符试试吧... http://blog.csdn.net/itzhiren/archive/2007/05/23/1621949.aspx 八成是在这些地方DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Textthis.bumen.Items[this.DropDownListNation.SelectedIndex].Text RadioButtonList2.SelectedItem.Text26行设置个断点。看看用到的值里哪个是null。 调试下下,看你26的值是不是NUll string con="ConfigurationManager.ConnectionStrings["CarManage"].ConnectionString)"; 看一下连接获取到没,进行调试一下。 检查 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 + "')"))里有没有空值 用断点。 怎么实现加减乘除? asp.net控件 onclick 如何动态显示password模式下textbox里的内容 Web Deployment 中文乱码(.NET2005) 配置错误 asp.net里如何实现鼠标停放在imgbutton上图片变化!?? SDK帮助文档窗口如何设置成左右排列? 问一个简单问题,热心人帮帮忙! 我会asp,那学asp.net用什么书好呢? 那位高手知道怎么用asp连接Sql Server 2000服务器?来者有分! Windows SharePoint Services Web Application 服务不能启动 asp.net怎么实现几天后交易关闭
比如你直接替换:
DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text
为一个字符试试吧...
this.bumen.Items[this.DropDownListNation.SelectedIndex].Text
RadioButtonList2.SelectedItem.Text26行设置个断点。看看用到的值里哪个是null。
看一下连接获取到没,进行调试一下。
里有没有空值 用断点。