Been through my textbook, but I'm still having problems with catching an inner exception as I try to add a record to the database. What is the proper syntax for catching an InnerException in my class?
The inner expection is being thrown on the db.SaveChanges. Here is the code in my 'addReviews.cs' class file to add the record:
public void addReview(int restId, int timeID, string dateValue, string describe, int cuisineId, int serviceId, int ambianceId, string memberId)
{
REVIEW addReview = new REVIEW();
addReview.REVIEW_DATE = Convert.ToDateTime(dateValue);
addReview.REVIEW_DATE_SUBMITTED = DateTime.Today;
addReview.REVIEW_DESC = describe;
addReview.TIME_ID = timeID;
addReview.REVIEWER_ID = 1;
addReview.FOOD_ID = cuisineId;
addReview.SERVCE_ID = serviceId;
addReview.AMBIENCE_ID = ambianceId;
addReview.REST_ID = restId;
addReview.PRICE_ID = 1;
//Add record to database
db.AddToREVIEWs(addReview);
db.SaveChanges();
}
Thanks in advance!