title: How to insert value into primary key identity column in SQL through C#?
body: <p>(My problem solved. As almost everyone said I had to remove @OB_ID and left it to SQL to assign value.)</p>
  
  <p>I want to insert a new record into a table in SQL database through C# code. The primary key is identity. How can I make Visual Studio understood that the column is identity so SQL Server must set the value. Here's the related code:</p>
  
  <pre><code>SqlConnection sqlc = new SqlConnection();
  sqlc.ConnectionString = "Data Source=. ; Database=LDatabase; Integrated Security=true;";
  
  SqlCommand cmd2 = new SqlCommand("INSERT INTO Order_Book VALUES(@OB_ID, @OB_Title, @OB_Author, @OB_TranslatedBy, @OB_Publisher)", sqlc);//@OB_ID is indentity primary key
              cmd2.Parameters.AddWithValue("@OB_ID", );//What should I assign to it?
              cmd2.Parameters.AddWithValue("@OB_Title", "%" + txtboxbook.Text + "%");
              cmd2.Parameters.AddWithValue("@OB_Author", "%" + txtboxAuthor.Text + "%");
              cmd2.Parameters.AddWithValue("@OB_TranslatedBy", "%" + txtboxTranslator.Text + "%");
              cmd2.Parameters.AddWithValue("@OB_Publisher", "%" + txtboxPublisher.Text + "%");
              sqlc.Open();
              cmd2.ExecuteNonQuery();
              sqlc.Close();
  </code></pre>
  
  <p>Any help would be appreciated. </p>