Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the knowledge of ADO query

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what is the knowledge of ADO query". In the daily operation, I believe that many people have doubts about the knowledge of ADO query. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "what is the knowledge of ADO query?" Next, please follow the editor to study!

Whether it is parametric data query information or stored procedures, the status of ADO query is very important. As long as command objects are used well, the most important thing of ADO query is that they do not support the submitted data query information containing comment fields.

ASP provides the use of ADO query built-in three main objects Recordset, Connection and Command to operate on the WEB database. The main function of Connection is to establish the link with WEB database; the main function of Command is to transmit the request of data query to WEB database; the main function of Recordset is to establish the result set of data query.

Because ADO is almost tailor-made for the application of WEB database, the ADO query in it has a powerful function in data query. It can not only send general SQL instructions to WEB database server, but also transmit SQL instructions with parameters, and more importantly, it can also transfer stored procedures, so it can develop more efficient database web pages.

I. the main properties and methods of the command object

In order to further elaborate the data query function of Command object, it is necessary to introduce some properties and methods of Command object which are closely related to data query.

Attributes:

(1) CommandText: specify data query information. Can be SQL statements, stored procedures.

(2) CommandType: specifies the type of data query You can take four set values, ActiveConnection: establish a link with the Connection channel.

Methods:

(1) Createparameter: create a new parameter object.

(2) Execute: put forward data query to the database. The Command object can use the Createparameter method to establish the ADO to query the new parameter object, and then use the append method of the parameters object to add the new parameter object to the parameters data collection. The result is to set up a parameter object named contract number, data type character, length 10, input read and write mode, parameter value "1000030005", and then add this parameter to the parameters data set. The Command object executes the database query using the Execute method, and the ADO query method allows you to pass in the specified parameters to achieve dynamic data query.

2. Several methods to realize dynamic data query with command object.

To realize dynamic data query with command object, first of all, the value of commandtext attribute must be a SQL instruction with parameters or a stored procedure with parameters, and the parameters referred to here must be the part of the query information that allows input values. The second is to call the execute method with parameter values ADO query array (format 3) or store the parameter values into the parameters data collection of the command object, and then call the execute method of the Command object.

A Command object can have multiple parameter sub-objects to store related parameters.

They all belong to the ADO query data collection. You can write parameter values to the parameters data collection in the following ways.

Suppose there is already a SQL Server database bcdata, in which a data table is gcht and there are three data fields, namely gchtbh (engineering contract number), gcmc (contract name) and htje (contract amount). Use command object to query the profile of engineering contracts in 1999 and 2000.

At this point, the study of "what is the knowledge of ADO query" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report