Copying Rowsets
来源:互联网 发布:flash player 12 mac 编辑:程序博客网 时间:2024/05/24 15:40
I find that you often need to create and manipulate standalone rowsets. Sometimes you can get the data for your standalone rowset from the database using the Fillmethod, however sometimes you'll want to copy from existing rowsets. This is where the CopyTo method comes in handy.
However there is one important thing to note when using CopyTo - it will only copy like-named record fields and subscrolls at corresponding levels
In order to work correctly, the record in the source rowset must have the same name as the record in target rowset, unless you specify a record list in the parameters.
For instance, say I have data in a rowset &rsExample with one record, EXAMPLE which is populated in the component buffer.
The EXAMPLE record has the following fields:
- EMPLID
- NAME
Now, say I want to copy the data from my rowset &rsExample to another rowset, &rsExampleAudit which consists of an audit record for EXAMPLE calledAUDIT_EXAMPLE.
The AUDIT_EXAMPLE record has the following fields:
- AUDIT_OPRID
- AUDIT_STAMP
- AUDIT_ACTN
- EMPLID
- NAME
What I want is to copy the like-name fields between &rsExample and &rsExampleAudit (the fields EMPLID and NAME).
The following code will NOT work:
&rsExample.CopyTo(&rsExampleAudit)
Why? Because &rsExample consists of a record named EXAMPLE, but &rsExampleAudit consists of a record named AUDIT_EXAMPLE. Because the two rowsets do not have the same underlying record name, the copy does absolutely nothing (quite frustrating!).
In this scenario, we need to specify a record list, so it knows the source and target record names. This how I need to write this code to make it work:
&rsExample.CopyTo(&rsExampleAudit, Record.EXAMPLE, Record.AUDIT_EXAMPLE)
Generically the syntax is:
&rsSource.CopyTo(&rsTarget, Record.SOURCE_RECNAME, Record.TARGET_RECNAME)
- Copying Rowsets
- Rowsets
- Copying File
- defensive copying
- 1131. Copying
- Copying DNA
- [C1.6] File Copying
- [C1.7] File Copying
- POJ 1505 Copying Books
- sawfish——copying
- poj 1505 Copying Books
- uva 714 Copying Books
- poj 1505 Copying Books
- PKU 1505 Copying Books
- UVa 714 - Copying Books
- uva 714 - Copying Books
- uva 714 - Copying Books
- 714 - Copying Books
- JS特效 小蜜蜂
- 使用strtok函数解析string类型数据
- JS 特效 用js实现radio选择钮效果
- “个人核心竞争力”与“危机感”
- AppWidget初步入门
- Copying Rowsets
- 12.21
- 下学期课表
- CSS中的class与id区别及用法
- Android Layout:LinearLayout
- 求解
- DIV滚动条滚到底部
- C学习总结
- 磁盘配额用户组的实现步骤