C#怎么实现蒋2个MDB里的数据导入。A表数据导入B表求代码

C#怎么实现蒋2个MDB里的数据导入。A表数据导入B表求代码

分别创建俩个数据库连接,连接A连接将A表数据取出读到缓存里,然后连接B连接循环将A数据插入B表 取数到dataTable,或者对象中循环。代码不复杂, public static SqlConnection connection;

    #region 数据源连接
    public static SqlConnection Connection
    {
        get
        {
            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["connectionStrBySQL"].ConnectionString.ToString();

                if (connection == null)
                {
                    connection = new SqlConnection(connectionString);
                    connection.Open();
                }
                else if (connection.State == System.Data.ConnectionState.Closed)
                {
                    connection.Open();
                }
                else if (connection.State == System.Data.ConnectionState.Broken)
                {
                    connection.Close();
                    connection.Open();
                }

            }
            catch (Exception ce)
            {
                MessageBox.Show(ce.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                connection.Close();
            }
            return connection;
        }
    }

```connectionString改变他,切换数据库。