如何在 MS Access 中创建存储过程? [英] How do I make a stored procedure in MS Access?

查看:31
本文介绍了如何在 MS Access 中创建存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 MS Access 中创建存储过程?

How do I make a stored procedure in MS Access?

推荐答案

Access 2010 既有存储过程,也有表触发器.而且,即使您不使用服务器(因此,在 100% 基于文件的模式下),这两个功能也可用.

Access 2010 has both stored procedures, and also has table triggers. And, both features are available even when you not using a server (so, in 100% file based mode).

如果您将 SQL Server 与 Access 结合使用,那么当然存储过程是使用 SQL Server 而不是 Access 构建的.

If you using SQL Server with Access, then of course the stored procedures are built using SQL Server and not Access.

对于 Access 2010,您打开表格(非设计视图),然后选择表格选项卡.您会在那里看到用于创建存储过程和表触发器的选项.

For Access 2010, you open up the table (non-design view), and then choose the table tab. You see options there to create store procedures and table triggers.

例如:

请注意,存储过程语言就像 Oracle 或 SQL Server (T-SQL) 一样具有自己的风格.以下示例代码用于更新水果订单表中的水果库存

Note that the stored procedure language is its own flavor just like Oracle or SQL Server (T-SQL). Here is example code to update an inventory of fruits as a result of an update in the fruit order table

请记住,这些是真正的引擎级表触发器.事实上,如果您使用 VB6、VB.NET、FoxPro 打开该表,甚至在未安装 Access 的计算机上修改该表,则将执行表级别的过程代码和触发器.因此,这是 Access 2010 数据引擎 jet(现在称为 ACE)的新功能.如前所述,这是运行的过程代码,而不仅仅是单个语句.

Keep in mind these are true engine-level table triggers. In fact if you open up that table with VB6, VB.NET, FoxPro or even modify the table on a computer WITHOUT Access having been installed, the procedural code and the trigger at the table level will execute. So, this is a new feature of the data engine jet (now called ACE) for Access 2010. As noted, this is procedural code that runs, not just a single statement.

这篇关于如何在 MS Access 中创建存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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