多个DW同时更新,且表中有关系存在,需要注意的击点问题。

来源:互联网 发布:软件如何注册 编辑:程序博客网 时间:2024/04/28 14:07
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

一次在做到多个同时更新的时候,出了些问题。

有必要写出来,引起注意。

虽然多个DW(3个)各自对应的都是一个表,但这些表间存在着关系,而且DW同时更新

比如:table_1:ID,  name,sex.......

         table_2:...ID(与table_1有对应关系),pro_1,pro_2......

         table_3:...ID(与table_1有对应关系),reg_time.....

由于没有经验:

第一次,后两个DW里在的时候,没有选择与第一个表相关的项----ID。

后来,发现无法更新。

只能从新设计,将table_2和table_3的ID项都分别选在各自的DW中,

但在界面中又不想让其出现,最好的办法---

设置他们的visable属性为False,也就是去掉属性里visable前的“钩”。

设计好后的编码中,我先开始的编码是:

ifDW_1.update()=1then

   ifDW_2.update()=1then

      ifDW_3.update()=1then

           commit;

      else

           rollback;

      endif

   endif

endif

----------------------------

但最好还是写成下面比较好:

file://加的SQLCA属性的处理(通用目的)
booleanlb_Tran
lb_Tran=sqlca.AutoCommit
sqlca.AutoCommit=false

IFDW_1.Update()<>1THEN
  MessageBox("操作提示","DW_1数据保存失败!")
  ROLLBACK;
  sqlca.AutoCommit=lb_Tran
  RETURN
ELSEIFDW_2.Update()<>1THEN
  MessageBox("操作提示","DW_2数据保存失败!")
  ROLLBACK;
  sqlca.AutoCommit=lb_Tran
  RETURN
ELSEIFDW_3.Update()<>1THEN
  MessageBox("操作提示","DW_3数据保存失败!")
  ROLLBACK;
  sqlca.AutoCommit=lb_Tran
  RETURN
ELSE
  COMMIT
ENDIF

------------------------------------------------------------------------

 
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>