title: {"Object reference not set to an instance of an object."}
body: <p>Creating a ASP.NET form with C#, i am facing this error i don't know what is the error with it. Its all doing fine but when i push the save Button it gives me this error:</p>
  
  <pre><code>     NulllRefrenceException was unhandled by user code
      {"Object reference not set to an instance of an object."}
  Object reference not set to an instance of an object.
  </code></pre>
  
  <h2>Code:</h2>
  
  <pre><code>     protected void Button8_Click(object sender, EventArgs e)
      {
           SqlConnection cnn = new SqlConnection();
           cnn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["sqlAddSave"].ConnectionString;
      cnn.Open();
      SqlCommand cmd = new SqlCommand();
      cmd.CommandText = "select * from  DisplayPP";
      cmd.Connection = cnn;
      SqlDataAdapter da = new SqlDataAdapter();
      da.SelectCommand = cmd;
      DataSet ds = new DataSet();
      da.Fill(ds, " DisplayPP ");
      SqlCommandBuilder cb = new SqlCommandBuilder(da);
      DataRow drow = ds.Tables["DisplayPP"].NewRow();
      drow["website"] = web.Text;
      drow["country"] = DropDownList1.SelectedItem.Text;
      drow["contact"] = TextBox144.Text;
      drow["cat"] = TextBox145.Text;
      drow["traff"] = TextBox146.Text;
  
      more text boxes as above
  
      ds.Tables["DisplayPP "].Rows.Add(drow);
      da.Update(ds, " DisplayPP ");
      string script = @"&lt;script language=""javascript""&gt;
      alert('Information have been Saved Successfully.......!!!!!.');
     &lt;/script&gt;;";
      Page.ClientScript.RegisterStartupScript(this.GetType(), "myJScript1", script);
      }
  </code></pre>
  
  <p>please help.</p>
  
  <h2>Connection String:</h2>
  
  <pre><code>&lt;add name="sqlAddSave" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\PPTableDisplay.mdf;Integrated Security=True"
  providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <h2>Exception</h2>
  
  <blockquote>
    <p>Exception Details: System.NullReferenceException was unhandled by user
    code HResult=-2147467261 Message=Object reference not set to an
    instance of an object. Source=TestCRole StackTrace: at
    TestCRole._Default.Button8_Click(Object sender, EventArgs e) in
    c:\Users\xxxxx\Documents\Visual Studio
    2012\Projects\WindowsAzure2\TestCRole\Default.aspx.cs:line 60 at
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    InnerException:</p>
  </blockquote>