title: update button codes for VB.net with sql-server
body: <p>I have create a library management system. here if I want to update a book's particular record its updating all the records in the SQL-server database. how can I write code for update a particular record only. here is my code,</p>
  
  <pre><code>Private Sub btnedit_Click(sender As Object, e As EventArgs) Handles btnedit.Click
  
      con.ConnectionString = "data source=hp-pc\sqlexpress; initial catalog=Library_DB;integrated security= true"
      con.Open()
      Dim comd As New SqlCommand("update  Book set Book_Id='" &amp; TextBox1.Text &amp; "',Bk_Name='" &amp; TextBox2.Text &amp; "',Author_Name='" &amp; TextBox3.Text &amp; "', Year_of_release='" &amp; TextBox4.Text &amp; "',Availability_of_bks='" &amp; TextBox5.Text &amp; "'", con)
      comd.ExecuteNonQuery()
      MessageBox.Show("Updated", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information)
  
  End Sub
  </code></pre>