Attributes, methods, events, and constants of ADO three major objects (2)

zhaozj2021-02-17  50

ADO's three major objects, methods, events, and constants (2) The main purpose of the Command object Command object is to perform parameterized stored procedures. The form is either temporary preparation (prepared) or a precompiled SQL statement. If you want (store) one or more queries for multiple executions on the same connection, the Command object is also useful. When you want to create RecordSet, an efficient way is to bypass the commord set.open method. Property Name Data Type and Use ActiveConnection Pointer Type, pointing to the Connection object associated with Command. For existing open connections, set cmmname.activeConnection = cnnname can be used. Alternatively, a new connection can be created using a valid connection string without using the associated Connection object name. The default is NULL. CommandText reads the String type. Specify an SQL statement, a table name, a stored procedure name, or an arbitrary string that the provider can accept for ActiveConnection. The value of the CommandType property determines the format of the CommandText property value. The default value is empty string: "" CommandTimeout reads the long type, specifying the time you must wait until a Command.execute call is aborted. The value at this time is preferred in the set value in Connection.comAndTimeout. The default is 30 seconds. CommandType reads the long type, specifying how the data provider explains the CommandText property value. CommandType is equivalent to an optional parameter LNGOption in the Connection.execute method. See the constant used in CommandType for details. The default value is adcmdunkown. Name Read Write String Type, specify the name of the Command. Prepared can read the Boolean type, determine whether the data source compiles the SQL statement in CommandText to Prepared Statement. Prepared Statement is only available in the ActiveConnection life cycle of Command. Many client / server RDBMS, including SQL Server, supports Prepared Statement. If the data source does not support Prepared Statement, set this property to true, which will result in a fallfrower error. State Readable LONG Type, specify the commnad status. See the State constant. Note: It is best to specify a suitable constant value for CommandType each time, otherwise the efficiency of the system operation will be reduced. Method Method Use CreateParameter must first declare an AdoDb.Parameter object first before performing this method. Calling syntax: cmmname.createParameter [strname [, lngtype "]]]]]]]]]]]]]]]]]]]]]]] EXECUTE call syntax is substantially the same as Connection.execute.

转载请注明原文地址:https://www.9cbs.com/read-29555.html

New Post(0)