Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8921435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:32:34+00:00 2026-06-15T06:32:34+00:00

In a Silverlight application I use a stored procedure to update a table of

  • 0

In a Silverlight application I use a stored procedure to update a table of my data base.

ALTER PROCEDURE  [dbo].[SP_ADD_MIS_MISSION] 
(
    @IdMission as int,
    @IdVersion as smallint,
    @LibMission as varchar (50)
)
AS
BEGIN
DECLARE @IDNEWVERSION as int = 1,
        @IDNEWMISSION as int = @IdMission,
        @supp as bit = 1
BEGIN
        IF @IdMission != 0 AND @IdMission is not NULL
        BEGIN
            SELECT @IDNEWVERSION = MAX(IDVERSION)+1 FROM MIS_Mission where MIS_Mission.IdMission=@IdMission

            Update MIS_Mission SET Suppression = @supp WHERE MIS_Mission.IdMission=@IdMission AND MIS_Mission.IdVersion=(@IDNEWVERSION-1)
        END
        ELSE
        BEGIN
            SET @IDNEWVERSION = 1
            select @IDNEWMISSION = MAX(MIS_Mission.IdMission)+1 from MIS_Mission

            if @IDNEWMISSION is NULL SET @IDNEWMISSION=1
        END

        Insert MIS_Mission ( IdMission,
                             IdVersion,
                             LibMission,
                             Suppression
                           )

                    values ( @IDNEWMISSION,
                             @IDNEWVERSION,
                             @LibMission,
                             @Suppression
                           )
        SELECT @IDNEWMISSION
END

I added this code in my WCF RIA services to launch the stored procedure:

public void SetMission(MIS_Mission mis)
{
    _entity.ADD_MIS_MISSION(mis.IdMission,mis.IdVersion,mis.LibMission);
}

And I added this code in my Silverlight application to update my database whith the value enter in my datagrid :

private void UpdateMission_Click(object sender, RoutedEventArgs e)
{

    foreach(MIS_Mission mis in dG_Mission.ItemsSource)
    {
        var operation = _Context.SetMission(mis);

        operation.Completed += (se, ev) =>
        {
        };
    }
}

But when I finished to update my database, my context didn’t updat whith the new values of IdVersion, and my datagrid display the old versions of my missions.

How can I update my context without reload my datagrid?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:32:35+00:00Added an answer on June 15, 2026 at 6:32 am

    I find a solution on this website : http://weblogs.asp.net/fredriknormen/archive/2009/11/24/refresh-the-cached-entityset-after-a-submitchanges-wcf-ria-services.aspx

    My solution is like this:

    private void UpdateMission_Click(object sender, RoutedEventArgs e)
    {
        int countenr = itemsSource.Count;
    
        foreach(MIS_Mission mis in dG_Mission.ItemsSource)
        {
            var operation = _Context.SetMission(mis);
    
            operation.Completed += (se, ev) =>
            {
                countenr--;
                if (countenr == 0)
                {
                    _Context.Load<MIS_Mission>(
                        _Context.ListMissionQuery(),
                        LoadBehavior.RefreshCurrent,
                        loadOperation =>
                        {
                           if (loadOperation.HasError)
                           {
                               MessageBox.Show(loadOperation.Error.Message);
                               loadOperation.MarkErrorAsHandled();
                           }
                           else
                           {
                               List<MIS_Mission> itemsource = dG_Mission.ItemsSource as List<MIS_Mission>;
                               var results = itemsource.Where(entity => !loadOperation.Entities.Contains(entity)).ToList();
    
                               results.ForEach(entity => itemsource.Remove(entity));
    
                               results = loadOperation.Entities.Where(entity => !itemsource.Contains(entity)).ToList();
    
                               results.ForEach(entity => itemsource.Add(entity));
    
                           }
                       }
                       ,null
                   );
                }
            };
        }
    }
    

    This solution work fine for me but the refresh of the datagrid is a bit slow.

    Thanks for your help
    bye

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application that I use the Beta2 T4 Self tracking entities
I have a client-server Silverlight application, which is use Socets. I have server appliaction
In a silverlight applicaiton i use entity framework as Data Access Layer. I want
I have a silverlight 3 application, that fetches some simple data from a ms-sql-server
I have a Silverlight Application that use a WebService for MultPorpose, When i usa
I want my silverlight application to use windows authentication so the user does not
I am planning to use coverflow control in my Silverlight application, but I am
I'm building a Silverlight application with Prism, and we'd like to use NInject. I've
I've created a custom control for use in my Silverlight application. Its template is
We've got a client who wants to use a SilverLight application hosted on our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.