Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update Not Working
Message
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01502033
Message ID:
01502040
Views:
43
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform