日期:2014-05-19  浏览次数:20877 次

运行报错,高手指点迷津
代码如下,当我填TextBox好点Button后,提示错误:未将对象引用设置到对象的实例。  
说明:   执行当前   Web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息:   System.NullReferenceException:   未将对象引用设置到对象的实例。

源错误:   行   77:   SqlConnection   myConn   =   new   SqlConnection(System.Configuration.ConfigurationSettings

弄了一天都没弄好,高手指点迷津。辛苦了,谢谢!!!!!!!!!!!


using   System;
using   System.Collections;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Web;
using   System.Web.SessionState;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.HtmlControls;
using   System.Data.SqlClient;
using   System.Configuration;

namespace   第n次
{
      public   class   WebForm2   :   System.Web.UI.Page
        {
            protected   System.Web.UI.WebControls.Label   Label1;
            protected   System.Web.UI.WebControls.Label   Label2;
            protected   System.Web.UI.WebControls.Label   Label3;
            protected   System.Web.UI.WebControls.Label   Label4;
            protected   System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator2;
          protected   System.Web.UI.WebControls.Label   Label5;
          protected   System.Web.UI.WebControls.CompareValidator   CompareValidator1;
          protected   System.Web.UI.WebControls.TextBox   nameTextBox;
          protected   System.Web.UI.WebControls.TextBox   PasswordTextBox;
          protected   System.Web.UI.WebControls.TextBox   PasswordagainTextBox;
          protected   System.Web.UI.WebControls.TextBox   addressTextBox;
          protected   System.Web.UI.WebControls.TextBox   emailTextBox;
          protected   System.Web.UI.WebControls.Button   Button1;
          protected   System.Web.UI.WebControls.Panel   InputPanel;
          protected   System.Web.UI.WebControls.Label   Label6;
          protected   System.Web.UI.WebControls.RequiredFieldValidator   RequiredFieldValidator1;
          private   static   string   strConn   =   System.Configuration.ConfigurationSettings.AppSettings[ "ConnectionStr "];  


private   void   Page_Load(object   sender,   System.EventArgs   e)
        {                  
                 
          }

        #region   Web   窗体设计器生成的代码
          override   protected   void   OnInit(EventArgs   e)
          {