Qasim Hafeez

Qasim Hafeez

  • NA
  • 67
  • 2.6k

Having a problem with inserting data into database

Jan 28 2017 2:38 PM
HI there, i tried a lot but i think im missing something here and i really could not find out, for me it seems to be right.
when i run the program and fill the forms the i get an error on savechanges() method ... 
 
using (var db = new StudentEntities())
{
var add = new Book_Record
{
Book_Id = Int32.Parse(txtID.Text),
Book_Title = txtTitle.Text,
Book_Type = txtType.Text,
Book_Author = txtAuthor.Text,
Book_Edition = txtEdition.Text,
Book_IssuedBy = txtIssuedBy.Text,
Book_IssuedTo = txtIssuedTo.Text
};
db.Book_Record.Add(add);
db.SaveChanges();
}
 

Answers (6)