コード例 #1
0
ファイル: SqlServerUtils.cs プロジェクト: geyanteng/readKR
        public void db3ToSqlServer(string tblName)
        {
            SqlCommand mycmd = new SqlCommand();

            mycmd.Connection  = connect;
            mycmd.CommandType = CommandType.Text;
            mycmd.CommandText = "select * from " + tblName;
            SqlDataAdapter myDataAdapter = new SqlDataAdapter(mycmd);
            DataSet        myDataSet     = new DataSet();

            myDataAdapter.Fill(myDataSet, tblName);
            DataTable myTable = myDataSet.Tables[tblName];
            KrDAO     krDAO   = KrDAO.getKrDAO();
            DataSet   dsKR    = new DataSet();

            dsKR = krDAO.getDataSet();
            DataTable dtKR = dsKR.Tables[tblName];

            Console.WriteLine(myTable.Rows.Count);
            Console.WriteLine(dsKR.Tables[tblName].Rows.Count);
            foreach (DataRow row in dtKR.Rows)
            {
                DataRow r = myTable.NewRow();
                r.ItemArray = (object[])row.ItemArray.Clone();
                myTable.Rows.Add(r);
            }
            Console.Write(myTable.Rows.Count);
            SqlCommandBuilder mySqlCommandBuilder = new SqlCommandBuilder(myDataAdapter);

            myDataAdapter.Update(myDataSet, tblName);
            connect.Close();
        }
コード例 #2
0
ファイル: krDAO.cs プロジェクト: geyanteng/readKR
 public static KrDAO getKrDAO()
 {
     if (_krDAO == null)
     {
         _krDAO = new KrDAO();
         _krDAO.krConnect();
     }
     return(_krDAO);
 }