i am continously get exception in dbContext save changes line? my data enters through sql 2012 but not from visual studio? anyone can help me how can i handle or remove this exception?
try
{
using (entity = new ShelfEntities())
{
bookTable book = new bookTable();
book.BookName = textBookName.Text;
book.BookAuthor = textBookAuthor.Text;
book.BookPrice = Convert.ToInt32(textBookPrice.Text);
entity.bookTables.Add(book);
entity.SaveChanges();
MessageBox.Show("successfull");
listBook.Items.Clear();
listBook.Items.AddRange(entity.bookTables.Select(x => x.BookName).ToArray());
}
}
catch (Exception y)
{
MessageBox.Show("" + y);
}