title: cmd.executenonquery is returning -1 in vb.net windows application
body: <p>I am just inserting a record in sqlserver database using stored procedure.
  In this code Binddata() is the method where i have binbed the gridview with records.</p>
  
  <p>here is the code:</p>
  
  <pre><code>Private Sub btnadd_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles btnadd.Click
  
      sqlSP = "INSERT_E_CLIENTMASTER_REC"
      strConnection = _
          ConfigurationManager.ConnectionStrings("connectstring").ConnectionString
      Dim conn As New SqlConnection(strConnection)
  
      conn.Open()
  
      Dim cmd As New SqlCommand(sqlSP, conn)
  
      cmd.CommandType = CommandType.StoredProcedure
  
      cmd.Parameters.Add(
          New SqlParameter("@CLIENTCODE", SqlDbType.VarChar, 100, _
              ParameterDirection.Input, False, 0, 0, "", _
              DataRowVersion.Proposed, txtclientcode.Text))
      'cmd.Parameters.Add( _
      '    New SqlParameter("@CLIENT_WEBXID", SqlDbType.NVarChar, _
      '        Convert.ToString(txtwebxid.Text))) _
      cmd.Parameters.Add( _
          New SqlParameter("@CLIENT_WEBXID", SqlDbType.VarChar, 100, _
              ParameterDirection.Input, False, 0, 0, "", _
              DataRowVersion.Proposed, txtwebxid.Text))
  
      cmd.Parameters.Add( _
          New SqlParameter("@ToEmail", SqlDbType.VarChar, 100, _
              ParameterDirection.Input, False, 0, 0, "", _
              DataRowVersion.Proposed, txttoemail.Text))
  
      cmd.Parameters.Add( _
          New SqlParameter("@ClientName", SqlDbType.VarChar, 100, _
          ParameterDirection.Input, _
          False, 0, 0, "", DataRowVersion.Proposed, txtclientname.Text))
  
      cmd.Parameters.Add(_
          New SqlParameter("@CcEmail", SqlDbType.VarChar, 100, _
          ParameterDirection.Input, False, 0, 0, "", _
          DataRowVersion.Proposed, txtccname.Text))
  
      Dim i As Int32 = cmd.ExecuteNonQuery()
      If (i &lt; 0) Then
          BindData()
          MsgBox("Record Inserted successfully ", MsgBoxStyle.OkOnly)
          txtclientcode.Text = ""
          txtwebxid.Text = ""
          txttoemail.Text = ""
          txtclientname.Text = ""
          txtccname.Text = ""
  
      Else
          MsgBox("Record Not Inserted successfully ", MsgBoxStyle.OkOnly)
      End If
  </code></pre>
  
  <p>End Sub</p>
  
  <p>In this code cmd.ExecuteNonQuery() is returning -1 so i have given (i&lt;0) condition actually it should be positive value when rows are affected.</p>
  
  <p>Thanks in advance.</p>