How to use ACCESS to call the background Stored Procedure

Source: Internet
Author: User
Tags odbc connection
ACCESS is an excellent front-end development tool of ClientServer. It is easy to learn and use, user-friendly, simple to develop, and flexible with other database interfaces.

ACCESS is an excellent front-end development tool for Client/Server. It is easy to learn and use, has a friendly interface, and has simple development, and is flexible with other database interfaces.

However, it is slow to process a large amount of data. When a large amount of data needs to be processed, it cannot be processed on the Client, but must be processed on the Server. However, ACCESS and Server are mostly connected through ODBC, which increases the difficulty of calling backend stored procedures. Through long-term exploration in practical work, I can use the following three methods to call the background storage process according to different business needs.
1. Access submits jobs to the backend. Each job corresponds to one stored procedure. In SQL Server 6.5, tasks are created through Task Manager, while in Oracle 8.0, jobs are created through Managing Job Queue. In Access, insert a job into the job_list table, which is generally run once every night. The businesses corresponding to these jobs generally need to process a large amount of data, but the real-time performance is relatively low. In our business, a typical example is a large amount of electricity computing every night.
2. Create some triggers on the Server and activate these triggers in Access. Both SQL Server 6.5 and Oracle 8.0 are implemented through Create Trigger. In Access, different triggers are activated by inserting, modifying, and deleting records based on different services. One example of our business is that when the business personnel modify the user's electric meter reading, the trigger for calculating the electricity bill is activated and the user's electricity bill can be recalculated immediately. In this way, you can share the same program with batchcompute and do not need to re-develop it on the Access end, which can speed up front-end response.
3. the preceding two methods can only be used to indirectly call the background stored procedure. Access also provides a method for directly calling. You can use Access to transmit queries and directly send commands to the database server.
The procedure for creating an Access transfer query is as follows:
(1) Click the "query" tab in the Database window, and then click the "new" button.
(2) In the "new query" dialog box, click the "design view" option, and then click the "OK" button.
(3) In the displayed table dialog box, click the close button.
(4) On the "query" menu, refer to "SQL statement conditions" and click "pass.
(5) on the toolbar, click "properties" to display the query Attribute Table.
(6) In the query Attribute Table, set the "ODBC connection string" attribute to specify the database information to be connected. You can enter the connection information: "ODBC; DSN = ntserver0; UID = sa; PWD =; DATABASE = BMS", or use the "Builder" button to generate the connection.
(7) because the stored procedure does not need to return records, set the "Return records" attribute to "no ".
(8) In the "SQL pass query" window, enter the pass query: exec statistics. Statistics is a stored procedure of the SQL Server database.
(9) Close the query and save the query as stat_query.
You can run the following query methods:
(1) Use the Microsoft Access macro OpenQuery.
(2) Use the following event process:
Private Sub statistics_click ()
Dim dbs As Database, qdf As QueryDef
Dim tmq As Dynaset
Dim strSQL As String
Set dbs = CurrentDb
'Open the pass query stat_query created above.
Set qdf = dbs. OpenQueryDef ("stat_query ")
Qdf. Execute
Set dbs = Nothing
End Sub
This method is completely fine in SQL Server 6.5 and cannot be implemented in Oracle 8.0. The error message is: ORA-00900 invalid SQL statement. because this method does not require an intermediate table to queue or activate the background storage process, it has a wide range of applications. Any business that needs to process a large amount of data can be put on the Server side for processing, such as statistical reports.
Through the above three methods, Access has solved the weakness of slow processing speed for a large amount of data, and greatly increased the data processing capability of Shenzhen Power Supply Bureau.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.