title: ExecuteNonQuery. connection property has not been initialized
body: <p>Hey guys im having this error on my codes but seems to work on the other new projects it always highlight the ExecuteNonQuery.
  I tried to search for solution with google and this site but guys I really don't know why it had below error.</p>
  
  <p>Also Im using in mssql express.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.Data.SqlClient;
  
  namespace AssetInsert
  {
      public partial class AssetInsert : Form
      {
          public AssetInsert()
          {
              InitializeComponent();
          }
  
      private void ICButton_Click(object sender, EventArgs e)
      {
          DBConn.DBOpen();
          lbConnTest.Text = "OK";
          DBConn.DBClose();
      }
      private void ISaveButton_Click(object sender, EventArgs e)
      {
          string sql = (@"INSERT INTO dbo.HWTable(Brand, CPU, RAM, HSerial, Model, ACode, PYear, UName, Position, Depart) VALUES('" + BrandCBox.Text + "', '" + CPUTBox.Text + "', '" + RAMTBox.Text + "', '" + HSerialTBox.Text + "', '" + ModelTBox.Text + "', '" + ACodeTBox.Text + "', '" + PYearPicker.Text + "', '" + UNameTBox.Text + "', '" + PositionCBox.Text + "', '" + DepartCBox.Text + "');");
          SqlCommand cmd = new SqlCommand(sql);
          DBConn.DBOpen();
          cmd.Parameters.AddWithValue("@Brand", BrandCBox.Text);
          cmd.Parameters.AddWithValue("@CPU", CPUTBox.Text);
          cmd.Parameters.AddWithValue("@RAM", RAMTBox.Text);
          cmd.Parameters.AddWithValue("@HSerial", HSerialTBox.Text);
          cmd.Parameters.AddWithValue("@Model", ModelTBox.Text);
          cmd.Parameters.AddWithValue("@ACode", ACodeTBox.Text);
          cmd.Parameters.AddWithValue("@PYear", PYearPicker.Text);
          cmd.Parameters.AddWithValue("@UName", UNameTBox.Text);
          cmd.Parameters.AddWithValue("@Position", PositionCBox.Text);
          cmd.Parameters.AddWithValue("@Depart", DepartCBox.Text);
          cmd.ExecuteNonQuery(); //&lt;--error here
          DBConn.DBClose();      
      }
  
      public class DBConn
      {
          public static void DBOpen()
          {
              string source = @"Data Source = 10.201.0.17; Initial Catalog = ITinven; USER ID = sa; PASSWORD = jc9989;";
              SqlConnection conn;
              conn = new SqlConnection(source);
              conn.Open();
          }
  
          public static void DBClose()
          {
              string source = @"Data Source = 10.201.0.17; Initial Catalog = ITinven; USER ID = sa; PASSWORD = jc9989;";
              SqlConnection conn;
              conn = new SqlConnection(source);
              conn.Close();
          }
      } 
  
  }
  </code></pre>