Table2:有数据,Table1:待取值
1.insert_recordSet
insert_recordset Table1(T1fieldName1,T1fieldName2)select T2fieldName1,T2fieldName2 from Table2;
2,buf2buf(注:Table1,Table2必须是同一张表)
buf2Buf(Table2,Table1)
3.针对不同表但字段名一致的
isSysId(fieldId):用于判断是否是系统字段,系统字段例如:createdDateTime,modifiedDateTime等
DictTable dictTable = new DictTable(Table2.TableId);
fieldId fieldId = dictTable.fieldNext(0);while (fieldId && ! isSysId(fieldId))
{if(fieldName2Id(Table1.TableId,fieldId2name(Table2.TableId,fieldId))){Table1.(fieldName2id(Table1.TableId,fieldId2name(Table2.TableId,fieldid))) = Table2.(fieldid);}fieldId = dictTable.fieldNext(fieldId);
}
4.针对临时表(该方法在报表DP类使用无效)
Table1.setTmpData(Table2);