title: Compare Number of Rows affected
body: <p>I'm trying to compare a string (network ID) and using a SQL Like command, return the numbers of rows affected (if the user name was found or not) however in my code I'm always getting " -1 " which i can not find why, the username is correct and found in the SQL table by running a query in SQL Server Mgt.</p>
  
  <pre><code>Try
          Dim Con As New SqlConnection
          Con.ConnectionString = "Data Source=WCRDUSMJEMPR9\SQLEXPRESS;Initial Catalog=MicroDB;Integrated Security=True"
          Con.Open()
          Dim SQL2 As String
          SQL2 = "SELECT * from MicroDB_Users WHERE Users LIKE '+@Usercheck+'"
          Dim cmd2 As New SqlCommand(SQL2, Con)
          cmd2.Parameters.AddWithValue("@Usercheck", TextBox1.Text)
          Dim obj2 = cmd2.ExecuteNonQuery
          Con.Close()
          If obj2 &gt; 0 Then
              MsgBox(obj2)
              Response.Redirect("~\ControlCharts\AddData_Control.aspx")
              Label7_Control.Visible = False
          Else
              MsgBox(obj2)
              Label7_Control.Text = ("You are not authorized to Add Data")
              Label7_Control.Visible = True
          End If
      Catch ex As Exception
          MsgBox(Err.Description)
  </code></pre>
  
  <p>As you can see, i;m using a IF to compare if the user was found ( 1 row affected) or if it was not found ( 0 rows affected).</p>