(Cannot insert explicit value for identity column in table 'book' when IDENTITY_INSERT is set to OFF.)
It looks like your ID column is set as IDENTITY column in your database.
2 options:
1. Either set this column to allow having values inserted by query OR
2. Don't pass/try to insert ID value. It will automatically get filled when you insert a new book.
Identity columns are generally primary key column and are set to self increment with every insert - this helps in maintaining a unqiue automatic ID generation. I would suggest to follow option 2 and don't pass ID at all. Let DB handle it by itself.
Do:
SqlCommand cmd = new SqlCommand("INSERT INTO book (name, year) VALUES (@b,@c)", con);
cmd.Parameters.AddWithValue("@b", textBox2.Text);
cmd.Parameters.AddWithValue("@c", textBox3.Text);