Properties provided by the command object:
Activeconnection: The activeconnection attribute can be used to set which command object the command object depends on.
Connection channel to communicate with the database, so this attribute can be directly passed into a connection object that has established a connection with the database
Or use the database link string more conveniently.
Commandtext: The commandtext attribute allows three types of data query information, including general SQL statements and databases.
Form NAME AND CHILDProgramName, which determines the Data Query Information is set by another commandtype attribute.
Commandtimeout: Sometimes the network condition is poor, resulting in slow network response.
After execution, the server database may fail to respond normally, resulting in stopping and waiting.
We can use the commandtimeout attribute to set the maximum time allowed to continue execution after the data query (execute) is executed.
. The default value of commandtimeout is 30 seconds.
Commandtype: You can use the commandtype attribute to specify the types of data query information. See the following table:
NAME value integer function
Adcmdtext 1 specifies the Data Query Information type as an SQL statement.
Adcmdtable 2 specifies the type of data query information as the database table name.
Adcmdstoredproc 4 specifies the type of data query information as the subroutine name
Adcmdunknown 8 unknown request information type
Prepared: If the Database Connection Control (such as ODBC) of the server provides the data query information precompilation function, we can set the prepared attribute to true, which can speed up database query.
Commandtype. storedprocedure
Commandtype. Text executes SQL statements.
Appendix: Use of ADO command in Delphi
Procedure tform1.button1click (Sender: tobject );
VaR
QQ: string;
Begin
QQ: = self. edit1.text;
Self. adocommand1.connectionstring: = 'provider = Microsoft. Jet. oledb.4.0; Data Source = db1.mdb; persist Security info = false ';
Self. adocommand1.commandtext: = 'insert into Ceshi (SS) values (''' + QQ + ''')';
Self. adocommand1.execute;
End;