Make a compilation component for your ASP program (top)
Source: Internet
Author: User
Write custom Active Server Page (ASP) code to accomplish some tasks, such as the ability of database access is important. But the most obvious problem with a scripting solution is performance. In this article, I'll show you how to convert a script version of a database object into a dynamic-link library (DLL), or just like its usual name, a COM component. To generate this compiled version, I will use Visual Basic 6 Service Pack 4. I've shown you how to create a VBScript object to simplify access to the data source. Because this object is likely to be used in large quantities, it is an ideal code that can be edited into COM components.
Visual Basic is a good development environment for creating COM components, and in version 6.0, the compiler becomes very efficient. In many cases, it can produce code as fast as C + +. This is not to say that you should not use C + +. Often, some projects require a C + + generated efficient components. But because of the speed of development and ease of use, most of the projects I'm involved in are like to choose Visual Basic. Of course, your choice of development language is purely a matter of personal preference, so I will leave you with the question of language choice.
Initial scripting code in order for you to recall previous content, List A shows the VBScript version of the database object in the previous article.
It is not difficult to convert this script to a Visual Basic component in Visual Basic. The first step is, of course, to start Visual Basic. screen displayed after startup (unless you have asked Visual Basic not to show it) Is the new Project dialog box as shown in figure A. Note that there is an ActiveX DLL option in it. Just select this option and then click the New button to generate a new Visual Basic project where all properties are set to create a COM DLL. It automatically generates a name class New class of 1.
Click the Project menu and choose Project 1 Properties to open the dialog box shown in Figure B. Here, you can change the name of the project or SET options that determine how the component is compiled. Name the project Dbutil and then select the Run independently checkbox. This option tells Visual Basic This component does not have any user interaction process. This basically means that all the error messages and outputs will be exported to the event record. All remaining settings are set to the default values and then click OK.
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