ADO command object

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.