We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GDBG supports dataset.merge?

I use dataset.merge to merge input changes to a GDBG datasource. GDBG will display duplicate records for modified rows. How can we update changes in GDBG to underlying database without retrieving? Private da As SqlDataAdapter Private ds As New DataSet() Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ... ds.Clear() da.Fill(ds, "dtCustomers") Me.GridDataBoundGrid1.DataSource = ds.Tables("dtCustomers") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ''merging changes to GDBG''s datasource. ds.Merge(ds.GetChanges) End Sub

1 Reply

AD Administrator Syncfusion Team February 24, 2005 07:45 AM UTC

Hi Frank I think you haven''t defined a primary key on your DataTable in the DataSet. The grid only relects what''s inside the DataTable. The line ds.Merge(ds.GetChanges) is a unneccessary roundtrip. You merge your own rows back to the same place where they come from. If you do a GetChanges and updating against the database, then you''ll have to do a merge of this data. DataSet modifiedData = ds.GetChanges() da.Update( modifiedData ) Me.GridDataBoundGrid1.BeginUpdate() ds.Merge( modifiedData ) Me.GridDataBoundGrid1.EndUpdate() Me.GridDataBoundGrid1.Refresh() Regards, Thomas >I use dataset.merge to merge input changes to >a GDBG datasource. GDBG will display duplicate >records for modified rows. How can we update changes in GDBG to underlying database without retrieving? > > Private da As SqlDataAdapter > Private ds As New DataSet() > > Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load > ... > ds.Clear() > da.Fill(ds, "dtCustomers") > > Me.GridDataBoundGrid1.DataSource = ds.Tables("dtCustomers") > End Sub > > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click >''merging changes to GDBG''s datasource. > ds.Merge(ds.GetChanges) > > End Sub

Loader.
Live Chat Icon For mobile
Up arrow icon