DoCmd.DeleteObject能够作用Vs之间的区别是什么DROP TABLE [英] What is the difference between DoCmd.DeleteObject acTable Vs. DROP TABLE

查看:564
本文介绍了DoCmd.DeleteObject能够作用Vs之间的区别是什么DROP TABLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

详细信息:

我有我的数据库在本地创建表的MS-Access数据库程序。不过,我想确保我创建表的测试,如果测试失败,我需要删除/下降已创建的其它表。基本上是一个回滚过程,我猜。

问:

我遇到了两种方法来删除表,而不能计算出,如果一个人比缺点更亲等...

谁能告诉我有什么区别?

非常感谢!

解决方案

  DoCmd.DeleteObject能够作用,aaaTest
 

...和...

 昏暗国开行作为DAO.DATABASE
设置CDB = CurrentDb
cdb.ExecuteDROP TABLE aaaTest,dbFailOnError
 

...和...

 昏暗国开行作为DAO.DATABASE
设置CDB = CurrentDb
cdb.TableDefs.DeleteaaaTest
 

...是完成同样的事情都只是不同的方式。他们删除与该名当地的TableDef 对象(无论是实际的本地表或表链接)。

Details:

I have an MS-Access Database procedure where I create tables locally in the database. However, I want to ensure that the tables I create are tested for and if the test fails I need to delete/drop the other tables that have been created. Basically a rollback procedure I guess.

Question:

I came across the two methods to delete tables but cannot figure out if one has more pro than cons etc...

Can someone tell me what the difference is?

Many Thanks!

解决方案

DoCmd.DeleteObject acTable, "aaaTest"

...and...

Dim cdb As DAO.Database
Set cdb = CurrentDb
cdb.Execute "DROP TABLE aaaTest", dbFailOnError

...and...

Dim cdb As DAO.Database
Set cdb = CurrentDb
cdb.TableDefs.Delete "aaaTest"

...are all just different ways of accomplishing the same thing. They delete the local TableDef object with that name (either an actual local table, or a table link).

这篇关于DoCmd.DeleteObject能够作用Vs之间的区别是什么DROP TABLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆