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 Fill method, 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 forEXAMPLE called AUDIT_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的更多相关文章

  1. 14——小心copying行为

    资源的copying行为决定对象的copying行为. 抑制copying行为,使用引用计数.

  2. UVa 714 Copying Books(二分)

    题目链接: 传送门 Copying Books Time Limit: 3000MS     Memory Limit: 32768 KB Description Before the inventi ...

  3. Effective C++ -----条款14: 在资源管理类中小心copying行为

    复制RAII对象必须一并复制它所管理的资源,所以资源的copying行为决定RAII对象的copying行为. 普遍而常见的RAII class copying行为是:抑制copying(使用私有继承 ...

  4. ACM: Copying Data 线段树-成段更新-解题报告

    Copying Data Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description W ...

  5. 抄书 Copying Books UVa 714

    Copying  Books 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=85904#problem/B 题目: Descri ...

  6. Copying Fields to a new Record

    This is a time saving tip for application designer. If you are creating a new record definition and ...

  7. UVA 714 Copying Books 二分

    题目链接: 题目 Copying Books Time limit: 3.000 seconds 问题描述 Before the invention of book-printing, it was ...

  8. poj 1505 Copying Books

    http://poj.org/problem?id=1505 Copying Books Time Limit: 3000MS   Memory Limit: 10000K Total Submiss ...

  9. [Effective C++ --014]在资源管理类中小心copying行为

    第一节 <背景> 条款13中讲到“资源取得的时机便是初始化时机”并由此引出“以对象管理资源”的概念.通常情况下使用std中的auto_ptr(智能指针)和tr1::shared_ptr(引 ...

随机推荐

  1. JMeter中3种参数值的传递

    小伙伴们在使用JMeter的过程中,肯定会遇到参数值传递的问题,下面来和大家总结下,在使用JMeter做压力测试的时候,常见的3种参数值的传递是怎样的. (一)从CSV文件读取要批量输入的变量 假如我 ...

  2. [ActionScript] AS3 涂鸦的擦除和撤销功能

    package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMo ...

  3. [SQL]SQL中把一个字段的数据分多行显示

    其实你完全可以写个自定义函数就OK了 . =================================================================== create func ...

  4. Net文章汇总帖

    DevExpress:Data Grid ExamplesHow to: Initialize Cells in Newly Created RowsHow to: Set a Cell Value ...

  5. nyoj 84 阶乘的0

    点击打开链接 阶乘的0 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 计算n!的十进制表示最后有多少个0 输入 第一行输入一个整数N表示测试数据的组数(1<=N& ...

  6. 9. Palindrome Number

    /* Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers ...

  7. PHP过滤HTML标签的三种方法

    在做项目的过程中,我们经常需要用到过滤一些html标签来实现提高数据的安全性,其实就是删除那些对应用程序有潜在危害的数据.它用于去除标签以及删除或编码不需要的字符.首先分享一些比较常见的 $str=p ...

  8. Web自动化框架LazyUI使用手册(2)--先跑起来再说(第一个测试用例-百度搜索)

    作者:cryanimal QQ:164166060 上篇文章中,简要介绍了LazyUI框架,本文便来演示,如何从无到有快速搭建基于lazyUI的工程,并成功运行第一个测试用例. 本文以百度搜索为例,选 ...

  9. 强大的内网劫持框架之MITMf

    Mitmf 是一款用来进行中间人攻击的工具.它可以结合 beef 一起来使用,并利用 beef 强大的 hook 脚本来控制目标客户端.下面让我们一起看看如何在 Kali2.0上安装使用 Mitmf ...

  10. nginx 代理配置文件实例

    安装NGINX前要先安装PCRE正则表达式库: ./configure --prefix=/usr/local/pcre 出现以下错误  (一般./configure即可, 笔者这里是直接./conf ...