Web-based Database Remote Access Technology in Mechanical CAD Software
With the rapid development of Internet/Intranet, the method of product development for manufacturing companies is rapidly changing. Enterprises are in the process of constructing an environment capable of designing and manufacturing in different places, and they are an important component of computer integrated manufacturing systems (CIMS). Part and source of information, product design information involved in computer-aided design (CAD) processes should enable information sharing among different companies and between different departments of the same company. For example, information consumers within an enterprise, including management departments, marketing departments, supply departments, etc., often need to review product design data and related materials. In order to meet the above requirements, product design information is published via a Web server, and browsing by the client through the browser will be the best means to achieve information sharing. As a new generation of dynamic web page development tools, ASP has high execution efficiency. With its components, it can easily access the database and query the latest data information in the database. At the same time, the ASP program interprets execution on the server side without having to select a specific browser and has a wider range. The scope of application. 1 Introduction to ASP ASP (Active Server Pages) is actually a dynamic web page running on a web server. The way ASP accesses data follows the CGI standard, but it greatly simplifies the programming method. ASP provides a server-side scripting environment, generates and executes dynamic, interactive, and efficient site server applications, and makes the site server automatically interpret the ASP program code as standard HTML content, generating relatively simple pages returned to Browser. Any simple browser can browse these generated pages, and dynamic web pages are not directly returned to the browser. The ASP file extension is .asp, which is a text file. The ASP file includes: HTML markup, VBScript or JavaScript language program code, ASP syntax. HTML Tags Use "<>" to include HTML program code, separate from regular text: ASP uses "<% %>" to include ASP's Scrtpt program code. 2 Built-in Objects of ASP In object-oriented programming, an object refers to a variable that consists of operations and data that are complete entities. Objects are based on a specific model. In an object, the client uses the object's service to access the object's data through an interface to a set of methods or related functions, which the client can then invoke to perform some operation. Use ASP's Server.CreateObject method to create an instance of an object, and use the script language's variable allocation directive to name the object instance. For example: Set db=Server.CreateObject("ADODB.Connection"), where the variable db is the object instance created by the ASP program to access the database. The current ASP version provides a total of six built-in objects: Request object: Get user information. Used to get any information passed by HTTP requests, including parameters passed using POST and GET, as well as cookies passed from server and client authentication. Response object: pass information to the user. You can use its methods to output information to the browser screen, or to transfer users to another URL, and to control the form of content and set cookie values. Server object: Controls the execution environment of the ASP. Provides access to Web server methods and properties. Session object: Stores information about the user's conversation. This object is only for one user. It can be used to record the user's preferences and keep a SessionID for each user. Application object: Sets properties for all users of the application and sends information to the user. ObjectContext object: Provides functions for handling things within the page. Using the above built-in objects, you can get the information from the browser, output information to the browser, record a single user, create the total user operation volume, and create components. 3 ASP method to access the site database ASP uses ADO (ActiveX Data Object) technology to access the background database, ADO is Microsoft's latest site database access technology, it is a component of the ASP, through the ODBC driver to connect the appropriate database. The process of ASP accessing the database is as follows: When the browser applies for accessing an ASP file from the Web server, the Web server calls the ASP file, then interprets each script statement, accesses the database through ODBC using the ADO component, and generates the HTML of the result of the execution. The file is passed to the client. The following describes the steps for ASP to access the site database. Set up the connection between ODBC and database. Start the "ODBC" in the control panel, create a new data source, press the "Add" button, select the data source driver, and then fill in the data source name (DSN) and database name. Create a connection. Use "Server.Createobject" to establish the connected object, use "Open" to open the database for the query to be accessed. Set conn=server.createobject("adodb.connec-tion") Opens the database. Call the conn.open method to open the database: Conn.open "dsn=:uid=:pwd=:" Call the conn.execute method to create a Recordset object. Set rs=conn.execute (parameters). Parameters can be SQL commands or a table name. Use the commands of the Recordset object to display the query results. Rs.fields(I).name: the first field name rs.fields(I).value: the value of the first field closes the database connection rs.close conn.close
<% sub rstotable(rs)
Response.write" "" ""
Figure 1 query interface
Figure 2 Basic dimensions of the cam mechanism
<% sub rstotable(rs)
Response.write"
"&rs.Fields (i).name & " | ""
" & rs.fields (i).value & " | " next response.write"