ASP basic knowledge Command object explanation_php basics
The Coonamd object defines the commands that will be executed on the data source. It can be used to query the database table and return a record set, and can also be used to add, change and delete the database table.
1. Steps to use Command object:
When using the Command object to process data in an ASP page, you should first set the command type, command text, and related active database connections, etc., and pass the command parameters through the Parameter object, and then execute the SQL statement or call by calling the Execute method Stored procedures to complete the task of retrieving, adding, changing, and deleting database records. The steps are as follows:
1. Use the ActiveCommand attribute to set the relevant database connection;
2. Use the CommandType attribute to set the command type;
3. Use the CommandText attribute to define the executable text of a command (such as a SQL statement);
4. Use the CommandTimeout attribute to set the command timeout;
5. Use the Execute method to execute the command.
2. Properties of Command object:
3. Methods of Command object——Execute
This method executes the query specified in the CommandText property. The syntax format is divided into the following two forms.
1. For Command returned by row:
Set recordset=command.Execute(RecordsAffected,Parameters,Options)
2. For Command that does not return by line:
command.Execute RecordsAffected,Parameters,Options
The parameter RecordsAffected is the number of records affected by the provider return operation. Rarameters are parameter values passed using SQL statements. Options instructs the provider how to assign a value to the Command object's CommandText property.
4. Use Parameters collection
Command objects have a Parameters collection consisting of Parameter objects that represent parameters or arguments associated with a Command object based on a parameterized query or stored procedure. You can pass the required data to a parameterized query by creating a Parameter object and adding it to the Parameter collection. The steps for using the Parameter collection are as follows:
Steps to use Parameter collection
5. Application examples of Command object
1. This is a simple employee basic situation management system. Its functions are: 1), add employee information; 2), change employee information; 3), delete employee information, and retrieve employee information. It contains seven pages and a database. They are:
1). Main page: index.asp
2). Add data page: add.htm
3). Save the add data page: add.asp
4). Change data page: Update.asp
5). Save the changed data page: Update1.asp
6). Delete record page: Detele.asp
7). Retrieve employee information page: shousho.asp
8) Database: RSGL.mdb. Use the "Employee Basic Information Table" in this database.
2. The code of each page is as follows:
1), main page: index.asp. The functions of this page are:
a) Create two objects, Connection object and Recordset object, whose purpose is to connect to the database and return a recordset;
b) Create a table and use the do while loop statement to display each record in the table;
c) Create three hyperlinks, one to connect to the add data page, another to connect to the change data page through the specified employee name, and one to connect to the delete page through the specified employee name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
2), add data page: add.htm.
This page consists of a form whose function is to submit data to the save and add data page (add.asp).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
3). Save the add data page: add.asp.
The functions of this page are:
a), use the Request object to obtain the value submitted from the add.htm page;
b), create three objects (connection object, recordset object and instruction object) and five parameters, and execute the INSERT insertion command by calling the parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
4), change data page: Update.asp. The functions of this page are:
a), create two objects, Connection object and Recordset object, whose purpose is to connect to the database and return a recordset;
b), create a form whose purpose is to submit the changed data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
5)、保存更改数据页面:Update2.asp。
该页面的功能有:
a)、使用Request对象获取从Update.asp页面提交的值;
b)、创建二个对象(连接对象、记录集对象);
c)、通过表格显示更改后的记录。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
6)、删除数据页面:Detele.asp。
a)、使用Request对象获取要删除的员工姓名;
b)、创建三个对象(连接对象、记录集对象和指令对象)和一个参数,通过参数指定的值删除记录;
c)、给出删除成功提示框。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
7)、检索员工资料页面 :shousho.asp。
a)、使用一个列表框用以提交检索的条件;
b)、创建三个对象(连接对象、记录集对象和指令对象)和一个参数,使用 Parameter 对象的 Value 属性将表单提交的值赋给参数;
c)、使用for 循环语句将检索出的记录集中的每一条记录都通过表格显示出来。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
以上就是关于ASP基础知识Command对象的入门教程,希望对大家的学习有所帮助,多多交流探讨。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Official documentation: https://docs.ansible.com/ansible/latest/command_guide/intro_adhoc.html Introduction Ad-hoc command is a command that is temporarily entered and executed, usually used for testing and debugging. They do not need to be saved permanently. Simply put, ad-hoc is "instant command". Commonly used modules 1. command module (default module) The default module is not as powerful as the shell. Basically, the shell module can support the functions of the command module. 【1】Help ansible-doccommand# It is recommended to use the following ansible-doccomm

ASP built-in objects include Request, Response, Session, Application, Server, Session.Contents, Application.Contents, Server.CreateObject, Server.MapPath, Server.Execute, Server.Transfer, etc. Detailed introduction: 1. Request: represents HTTP request object, etc.

ASP development tools include Visual Studio, Dreamweaver, FrontPage, EditPlus, UltraEdit, SQL Server Management Studio, RAD Studio, Delphi, Asp.NET and Oracle SQL Developer.

ASP scanning tool vulnerability detection: 1. Select the appropriate scanning tool; 2. Configure the scanning target in the scanning tool; 3. Configure scanning options as needed; 4. After the configuration is completed, start the scanning tool to start scanning; 5. Scanning tool A report will be generated listing the detected vulnerabilities and security issues; 6. Fix the detected vulnerabilities and security issues according to the recommendations in the report; 7. After fixing the vulnerability, re-run the scanning tool to ensure that the vulnerability has been successfully exploited repair.

ASP manual detection of vulnerabilities: 1. Check the ASP application's verification and filtering mechanism for user input; 2. Check the ASP application's encoding and filtering mechanism for output data; 3. Check the ASP application's authentication and session management mechanism; 4. Check the ASP application's permission control on files and directories; 5. Check the ASP application's handling of errors; 6. Check the ASP application's database security; 7. Check the ASP application's configuration file and server configuration.

Methods include: 1. Use specialized vulnerability scanning tools; 2. Manual testing to discover and verify vulnerabilities in ASP applications; 3. Conduct security audits to check the code and configuration files of ASP applications; 4. Use vulnerability exploitation frameworks; 5. Review the code of the ASP application.

iPhone average selling price (ASP) achieved double-digit growth last year, growing 14% year-on-year. The popularity of iPhone 13 is a key driver, helping push the global smartphone market as a whole to a record annual revenue of $448B. Despite parts shortages, the smartphone market grew 7% year-on-year, with Apple taking by far the largest share... Market intelligence firm Counterpoint released its latest estimates today. According to the latest research from Counterpoint's MarketMonitorService, the global smartphone market revenue will exceed US$448 billion in 2021. Even as component shortages and COVID-19 restrictions continue to disrupt global supply

Connection method: 1. Use ADO to connect to the database; 2. Use DSN to connect to the database; 3. Use the connection string to connect to the database.
