w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
how to connect two connection strings and insert data from one database into another MySQL database
  1. After you open first connection, get what you want to get into a DataTable, array, whatever.
  2. Close the connection and open the second one.
  3. Push what you want to push from that data you got from first db.

For third step, you can create an sql command dynamicly like this:

string sql="";
foreach(DataRow dr in yourdatatable.Rows){
   sql += "INSERT INTO table2 (column1) VALUES ('"+dr["something"]+"'); ";
//and here execute this sql

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.