Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to insert data from one server database table to other server database table using c#

For example I have two SQL server A and B. I want to create one service which will insert data from one server dB to other server dB table. Please help me on this it's urgent.

What I have tried:

Two server A and B
.Data table a = data table B
Posted
Updated 23-May-18 10:38am

You need two data connections one for each db. Open the first and pull your data. close it and open the second connection and do your update
 
Share this answer
 
Comments
Member 12932251 23-May-18 22:14pm    
Can you share me c# code for get and update data.
RmcbainTheThird 24-May-18 11:49am    
Sorry no, I spend enough time writing my own code and am not willing to do yours for free. If you are unsure how to get a connection string from your config file, open a database, query the database, build an insert query with the data from the first query then you need to pick up a book or hit Google to understand and utilize these concepts.
If it's an SQL Server...

You can use SqlBulkCopy Class (System.Data.SqlClient)[^]

For further details, please see: SQL Server Data Operations in ADO.NET | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900