SubmitChanges not working? RRS feed

  • Question

  • For whatever reason, in this section of code, db.SubmitChanges() doesn't work.  It works everywhere else I try to manipulate a Club object, and I've triple checked my dbml and database to ensure that db.Clubs has a primary key.  Any thoughts as to what I'm doing wrong?


    public void Promote(Season newSeason)
                NSLDataContext db = new NSLDataContext();
                List<Club> promotedClubs = new List<Club>();
                foreach (League l in db.Leagues)
                    if (l.Tier != 1)
                        List<Club> leagueClubs = new GetObjects().GetLeagueClubs(newSeason.Simulation, l.id).OrderByDescending(c => c.LeaguePoints).ThenByDescending(c => c.LeagueGoalDifference).ThenByDescending(c => c.LeagueWins).ThenByDescending(c => c.Overall).ToList();
                        Club one = leagueClubs.ElementAt(0);
                        Club two = leagueClubs.ElementAt(1);
                        if (l.Tier < 5)
                            one.League = one.League - 1;
                            two.League = two.League - 1;
                        else if (l.Tier < 11)
                            one.League = one.League - 2;
                            two.League = two.League - 2;

    Tuesday, August 27, 2013 9:37 PM

All replies

  • Are you getting any exceptions?

    What is GetObjects and GetLegueClubs methods?

    What is GetChangeSet reporting?

    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, August 28, 2013 3:54 AM