foreach( DataRow row in table2.Rows )
   table1.ImportRow( row );

解决方案 »

  1.   

    最笨的办法:速度非常慢
    foreach(DataRow dr in dsRemote.Tables[0].Rows)
    {
    //先查找;
    string strTmp=PKID+"='"+ dr[PKID].ToString() +"'";
    DataRow[] Row=dsTemp.Tables[0].Select(strTmp);
    if (Row.Length != 0)
    {
    //如果重新就覆盖
    //Row[0].Delete();
    foreach(DataRow Dr in Row)
    {
    Dr.ItemArray=dr.ItemArray;
    }
    //dsTemp.AcceptChanges();
    }
    else
    {
    //如果没有查找到就添加
    DataRow row=dsTemp.Tables[strTableName].NewRow();
    row.ItemArray=dr.ItemArray;
    dsTemp.Tables[strTableName].Rows.Add(row);
    }