title: How to delete rows by ID in SQL Server using VB
body: <p>I am using Microsoft Visual Studio 2010 and SQL Server 2005 with the Management Studio.
  And I am new to this programming language.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Delete.Click
      If MessageBox.Show("Do you really want to delete this record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.No Then
          MsgBox("Operation cancelled")
      Else : Try
              Dim Command As New SqlCommand
              Dim con As SqlConnection = New SqlConnection("Server=HPC-107;Database=MRPdb;integrated security=sspi;...")
              con.Open()
              Command.CommandText = "DELETE * FROM dbo.inhouse_hardware_marterfile_tbl WHERE Equip_No ='" &amp; (Equip_No.Text) &amp; "'"
              Command.Connection = con
              Command.ExecuteNonQuery()
              con.Close()
  
          Catch ex As Exception
          End Try
  
          Exit Sub
      End If
  End Sub
  </code></pre>
  
  <p>I can't get any results whenever I run it. Any help is appreciated. Thanks! :D</p>