title: ExecuteNonQuery() for Insert
body: <p>Can you please tell me what's wrong with this code? </p>
  
  <p>Do I need to use <code>DataAdapter</code> to insert into a table?</p>
  
  <p>I know the <code>connectionString</code> is ok, because I tested it on the Server Explorer.</p>
  
  <pre><code>    Dim mydao As New Connection
      Dim connectionString As String = mydao.GetConnectionString()
      Dim connection As New SqlConnection(connectionString)
      Dim cmd As New SqlCommand
  
  Public Function add(ByVal area As String, ByVal user As String) As Integer
  
          cmd.CommandText = "INSERT into Area (Area, user) VALUES ('" + area + "','" + user + "')"
          Try
              connection.Open()
              Dim cant As Integer = cmd.ExecuteNonQuery()'it throws exception here
              connection.Close()
              Return cant
          Catch ex As Exception
              Console.WriteLine(ex.Message)
              Return 0
          End Try
  
      End Function
  </code></pre>
  
  <p>The above code fails just after <code>ExecuteNonQuery()</code> and can´t figure why.</p>
  
  <p>TARGET FIELDS (SQL Server 2008):</p>
  
  <pre><code>AREA        varchar(100)  NOT NULL ,
  USER        varchar(100)  NOT NULL 
  </code></pre>
  
  <p>The exception I receive is: <code>Connection property has not initialized</code></p>