Hello,
See
the following code sample for Entity Framework. If using SQL-Server w/o Entity Framework e.g. create a connection and command using the managed data provider SqlClient using containers such as a DataTable then look at using
MERGE.
A high level example for MERGE where cmd is a SqlClient.SqlClientCommand.

Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via
my MSDN profile but will not answer coding question on either.
NuGet BaseConnectionLibrary for database connections.
StackOverFlow
