使用 SPROC 从 MS Access 前端将记录插入 SQL Server 后端
我对使用 SPROC 有一些具体的担忧:
- 子表单:我可以轻松设想使用未绑定表单通过 SPROC 对大多数表进行插入。但是,我不知道如何为从属表添加记录。通过主窗体上的未绑定控件或从主窗体启动的弹出窗体?其中任何一个都将偏离我的用户习惯看到的界面。
- 版本控制:我的 Access 应用程序受到严格的版本控制。我是否最好使用传递查询将所有程序逻辑保留在一个位置,或者使用物理存储在后端数据库中的存储过程还有其他好处吗?
- 改造:是否实用/值得大规模(即数十种形式)进行?
I recently ran into major problems inserting records into a SQL Server backend from an MS Access frontend because I was using bound forms to do the inserts. Multiple commenters suggested using SQL Server stored procedures to do the inserts instead. How is this normally done? Is there general agreement that using SPROCs is a better approach than using bound forms in this scenario?
I have a few specific concerns about using SPROCs:
- Subforms: I can easily envision using unbound forms to do inserts via SPROCs for most tables. However, I don't know how I would approach adding records for subordinate tables. Via unbound controls on the main form or a pop-up form launched from the main form? Either of these will be a departure from the interface my users are used to seeing.
- Version Control: I have my Access applications under tight version control. Am I better off using pass-through queries to keep all the program logic in one place or are there other benefits to using stored procedures that are physically stored in the backend database?
- Retrofitting: Is it practical/worth doing on a large scale (ie, dozens of forms)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据库中的存储过程使您可以在 Access 应用程序之外重用它们。
版本控制:如何对其余 sql 数据库对象提供版本控制?如果可以将表置于版本控制之下,则可以放置过程,除非所有表创建和更新代码都在 Access 中。
除非存在数据完整性或可能的性能问题,否则我不会优先考虑改造您的表单。您可以随着时间的推移或发生更改/更新时执行此操作。
Stored procedures in the database give you the benefit of reusing them outside of your Access application.
Version Control: how are you providing version control on the rest of the sql database objects? If you can put a table under version control, you can put a proc unless all of your table create and update code is in Access.
I wouldn't prioritize retrofitting your forms unless there are data integrity or possibly performance concerns. You can do this over time or when changes/updates are taking place.