>Why doesn't this work????
>
>
>using (AppSecurityDataContext dc = GetDataContext())
>{
> tblUsersInApplication uia = new tblUsersInApplication
> {
> UserId = um.UserId,
> ApplicationId = LoginCredentials.ApplicationId,
> LastLoginDateTime = DateTime.Now
> };
>
> try
> {
> dc.SubmitChanges();
> }
> catch (Exception e)
> {
> Error = e;
> }
>}
>
>
>I get no exceptions. Runs fine. The date/time doesn't show up in the SQL table after it runs.
Is this Entity Framework? (I'm guessing it is.)
You need to add the new item to the context, if it's not a child entity EF will have created a function something like this:
dc.AddTotblUsersInApplication(uia);
If it's a child you just add it to the reference collection on the parent entity.