TextBox value not updated

Posted by Jignesh on Stack Overflow See other posts from Stack Overflow or by Jignesh
Published on 2010-01-17T12:19:19Z Indexed on 2010/05/22 23:10 UTC
Read the original article Hit count: 272

Filed under:

I am fetching data from database to textbox using Linq.When i try update the same textbox value,it does not work.

DAL.TournamentsDataContext tdc = new SchoolSports.DAL.TournamentsDataContext();
        var tournamentTable = tdc.GetTable<DAL.Tournament>();
        var tournamentRecord = (from rec in tournamentTable
                                where rec.TournamentId == TournamentId
                                select rec).Single();           

        tournamentRecord.Tournament_type = Tournament_type;
        tournamentRecord.Tournament_Name = Tournament_Name; ;
        tournamentRecord.Tournament_Level = Tournament_Level;
        tournamentRecord.Tournament_For = Tournament_For;
        tournamentRecord.Country_Code = Country_Code;
        tournamentRecord.Tournament_Status = Tournament_Status;
        tournamentRecord.Tournament_begin_date = Tournament_begin_date;
        tournamentRecord.Tournament_end_date = Tournament_end_date;
        tournamentRecord.Sponsored_By = Sponsored_By;
        tournamentRecord.Tournament_Details = Tournament_Details;

        var organiserTable = tdc.GetTable<DAL.Organiser>();
        var organiserRecord = (from rec in organiserTable
                               where rec.Tournament_Id == TournamentId
                               select rec).Single();    
        organiserRecord.Name_Of_Organiser = OrName;
        organiserRecord.Telephone = OrTeleNo;
        organiserRecord.Email = OrEmail;
        organiserRecord.Mobile = OrMobile;
        organiserRecord.Fax = OrFax;

        if (Tournament_For == "School")
        {

            var invitedSchoolIdTable = tdc.GetTable<DAL.Invited_School>();
            var invitedSchoolIdRecord = (from rec in invitedSchoolIdTable
                                         where rec.Tournament_Id == TournamentId
                                         select rec).Single();
            invitedSchoolIdRecord.School_Ids = SchoolUniIds;

        }
        if (Tournament_For == "University")
        {

            var invitedUniversityTable = tdc.GetTable<DAL.Invited_University>();
            var invitedUniversityIdRecord = (from rec in invitedUniversityTable
                                             where rec.Tournament_Id == TournamentId
                                             select rec).Single();
            invitedUniversityIdRecord.University_Ids = SchoolUniIds;

        }
        tdc.SubmitChanges();

© Stack Overflow or respective owner

Related posts about linq-to-sql