简体   繁体   中英

Using SPROCs to insert records in SQL Server backend from MS Access frontend

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)?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM