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

How does ADO deal with data asynchronously?

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

Share

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

This article mainly introduces "ADO processing data asynchronous execution mode is what", in daily operation, I believe many people in ADO processing data asynchronous execution mode is what the problem is there are doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "ADO processing data asynchronous execution mode is what" doubts helpful! Next, please follow the small series to learn together!

In ADO processing data, you can create a object by specifying connections and command text. There are rules about the position and type of cursor. You can read the data as follows, but ADO provides asynchronous execution of the data in addition to synchronous execution

After ADO processes the data, ADO notifies the application program in the form of an event, and the application program can take corresponding actions according to the results of ADO execution. There are many uses for asynchronous execution, for example, if your application needs to process time-consuming actions, ADO can choose to execute asynchronously in the background while the application continues to process graphical user interface or user-entered data.

Using asynchronous execution in ADO is very simple. You only need to set the ExecuteOptions attribute value of ADO dataset appropriately. Let's now illustrate how ADO can process data asynchronously with a real-world example application

1)Close all projects in the D e l p h i IDE.

2)Create a new application project and place a TA D O C o n e c t i o n object in the main form to connect to the database.

3)Put the TA D O D a t a S e t component in the main window. Set its C o n e c t i o n attribute value to TA D O C o n e c t i o n of step 2) and use Select * from ADO Te s t D a t a s in its C o m a n d Te x t attribute value to get all ADO processed data. Then set its A c t i v e attribute value to Tru e to open the sample data table.

4)Put in the TDataSource component and set its DataSet attribute value to the TADODataSet component added in step 3).

Study on ADO attribute method

Description of ADO. NET asynchronous operations

Detailed description of ADO timeout related issues Introduction

Description ADO. NET commands affect data sources Description

How to better connect ADO. NET connection pools

5)Put in T D B N a v i g a t o r and T D B G r i d components, and set their D a t a S o r c e components as T D a t a S o r c e components added in step 4.

6)Put two T B u t o n components and one T P r o g r e s B a r component in the main form and set its associated attribute values.

7)*** Put a TA D O C o m a n d component in the main window. Set its C o n e c t i o n attribute value to TA D O C o n e c t i o n of step 2) and use S e l e c t count(*) from ADO Te s t D a t a s in its C o m a n d Te x t attribute value to get the number of entries for all data from the A D O Te s t D a t a s data table.

8)Write the following program code in the ADO processing data sequence of the main form:

p r o c e d u r e TForm1.FormActivate(Sender: TObject); v a r sRecNo : String; b e g i n ProgressBar1.Max := ADOCommand1.Execute.Fields.Item[0].Value; sRecNo := IntToStr(ProgressBar1.Max); Self.Caption : ='Total ' + sRecNo + ' pen data'; e n d ;

9)Double-click the e o A s y n c F e t c h N o n B l o c k i n g button in the form and at its O n C l i c k event

At this point, the study of "ADO processing data asynchronous execution mode is what" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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