using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Windows.Forms;
using System.Data;namespace test
{
    class clExec
    {
        static void Update_Table(string nCmd_E, string nCmd_T, string nTable)
        {            
                SqlConnection nConn_ERP = new SqlConnection();
                nConn_ERP = clConnection.fConnection("ERP3");
                nConn_ERP.Open();
                SqlCommand nCmd_ERP = new SqlCommand(nCmd_E,nConn_ERP);
               
                SqlDataAdapter nDA_ERP = new SqlDataAdapter(nCmd_ERP);
                DataSet nDS_ERP = new DataSet();
                
                nDA_ERP.Fill(nDS_ERP,nTable);
                 if (nDS_ERP.Tables[0].Rows.Count > 0)
                {
                    SqlBulkCopy nBC_Test = new SqlBulkCopy("Data Source=.;Initial Catalog=SQLTest;Integrated Security =true;");
                    try
                    {
                        nBC_Test.DestinationTableName = nTable;
                                                nBC_Test.WriteToServer(nDS_ERP.Tables[0]);                                                MessageBox.Show("更新成功");
                         
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("出现异常:" + ex.Message);
                    }
                    finally
                    {
                        nConn_ERP.Close();
                        nBC_Test.Close();
                                           }
                }
                else
                {
                    MessageBox.Show("没有更新");
                }          
        }
        public static void nExec()
        {
            clExec.Update_Table(clCmdERP.BillVouchs(), clCmdTest.BillVouchs(), "SA_BillVouchs");
                 
        }
    }
}从源数据库中按条件搜索数据,填充到dataset中,再通过sqlbulkcopy复制到目的数据库中,一直出现错误。
试了很多方法了都没有办法完成