none
Microsoft Sync Framework RRS feed

  • Question

  • Hi All,

                 I am unable to get only changes in datatable using below code.Is there any wrong.Please help me.Suggestions would be appriciated

     

       public void ClientChangesSelected(object sender, DbChangesSelectedEventArgs e)
            {


               

                if (e.Context.DataSet.Tables.Contains("emp"))
                {
                    var dataTable = e.Context.DataSet.Tables["emp"];
                    if (dataTable.Rows.Count > 0)
                    {

                        for (int j = 0; j < dataTable.Rows.Count; j++)
                        {
                            DataRow row = dataTable.Rows[j];
                            if (row.RowState == DataRowState.Added || row.RowState == DataRowState.Modified || row.RowState == DataRowState.Deleted)
                            {
                               
                                dataGridView1.DataSource = dataTable;
                            }
                           
                        }
                    }
                }
            }
            public void ServerChangesSelected(object sender, DbChangesSelectedEventArgs e)
            {

              

                if (e.Context.DataSet.Tables.Contains("emp"))
                {
                    var dataTable1 = e.Context.DataSet.Tables["emp"];
                    for (int j = 0; j < dataTable1.Rows.Count; j++)
                    {
                        DataRow row = dataTable1.Rows[j];
                        if (row.RowState == DataRowState.Added ||row.RowState == DataRowState.Modified || row.RowState == DataRowState.Deleted)
                        {
                           dataGridView2.DataSource = dataTable1;

                        }
                       
                    }
                }
            }

    Friday, July 8, 2011 8:02 AM

All replies

  • Is this quesion related to the Sync Framework? What exactly are you trying to accomplish with this code?

    Tuesday, July 19, 2011 9:21 PM
    Moderator