Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 7th, 2007, 07:49 AM
Registered User
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fill a DataSet from another DataSet

My task is to fill a DataSet from a data source and update another data source in C#.

For example I have two databases in SQL Server (i.e. db1 and db2).
I have table named ProdMkt_Contrib_Link in db1 with following columns:

ProdMktContributorID (PK)

The above columns data should be mapped/sync to the table named
ProdMktContribLink in db2:

ProdMktContributorID (PK)

Note: The table name and few column name are different.

Suppose few records are added and few are updated in the
db1.ProdMkt_Contrib_Link table.

I have filled the typed DataSet (DS1) with db1.ProdMkt_Contrib_Link (this contains only added and updated records) ans also filled the another DataSet (DS2) with db2.ProdMktContribLink (this contains all records).

Now I want that DS1 should be sync with the DS2. That is, the added records should be added to the DS2 table rows and also updated records should be updated to the DS2 table rows.

What is the best way to accomplish this in c#. Please suggest any good design or sample code.


Old February 7th, 2007, 11:14 AM
Authorized User
Join Date: Apr 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts

Are the two typed DataSets, DS1 and DS2 of the same type? Although they have records from different database tables it can be the same. If this is true can't you use the DataSet Merge?

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to fill a dataset from a gridview sigilaea ASP.NET 2.0 Basics 3 July 19th, 2007 03:16 PM
Fill(dataset) or dataset.load() salemkoten SQL Server 2005 1 November 2nd, 2006 11:04 PM
fill dataset with oracle sp p2pMember ASP.NET 1.0 and 1.1 Professional 1 October 4th, 2006 04:19 AM
How to fill stored procedure in dataset. jayaraj ADO.NET 4 August 2nd, 2004 02:40 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.