0

I have this:

var status = new OutTransStatus();
status.StartDate = startDate;
status.TransCount = transactions.Count;
try
{
   context.OutTransStatus.Add(status);
}
catch (Exception)
{
   return 2;
}

Now, when i try to add status, it goes by, no exception, no nothing, and the row is not applied to the database! What is going on? How can i debug this?

Edit: Obviously, somewhere above i have using (var context = new Database())

4

1 回答 1

2

You forgot to save changes:

context.SaveChanges()

于 2013-02-08T16:54:48.620 回答