Đối tượng lệnh ADO


Đối tượng lệnh

Đối tượng ADO Command được sử dụng để thực hiện một truy vấn duy nhất đối với cơ sở dữ liệu. Truy vấn có thể thực hiện các hành động như tạo, thêm, truy xuất, xóa hoặc cập nhật bản ghi.

Nếu truy vấn được sử dụng để lấy dữ liệu, dữ liệu sẽ được trả về dưới dạng đối tượng RecordSet. Điều này có nghĩa là dữ liệu được truy xuất có thể được thao tác bởi các thuộc tính, bộ sưu tập, phương thức và sự kiện của đối tượng Recordset.

Tính năng chính của đối tượng Command là khả năng sử dụng các truy vấn và thủ tục được lưu trữ với các tham số.


ProgID

set objCommand=Server.CreateObject("ADODB.command")

Tính chất

Property Description
ActiveConnection Sets or returns a definition for a connection if the connection is closed, or the current Connection object if the connection is open
CommandText Sets or returns a provider command
CommandTimeout Sets or returns the number of seconds to wait while attempting to execute a command
CommandType Sets or returns the type of a Command object
Name Sets or returns the name of a Command object
Prepared Sets or returns a Boolean value that, if set to True, indicates that the command should save a prepared version of the query before the first execution
State Returns a value that describes if the Command object is open, closed, connecting, executing or retrieving data

Phương pháp

Method Description
Cancel Cancels an execution of a method
CreateParameter Creates a new Parameter object
Execute Executes the query, SQL statement or procedure in the CommandText property

Bộ sưu tập

Collection Description
Parameters Contains all the Parameter objects of a Command Object
Properties Contains all the Property objects of a Command Object