The Delphi connection Access graphic tutorial data (2)

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

The 3 control

4 controls that we use are: TDataSource; TADOConnection; TADOQuery; TDBGrid; their role: TDataSource is used to store the query data obtained from the database; TADOConnection: responsible for connecting to the database; TADOQuery: responsible for executing the query; TDBGrid is responsible for displaying the data in a database table control. The work order is, first of all TADOConnection get connected, to be associated with our previous configuration UDL file. Then the results and the TADOQuery Association, so TADOQuery can query, otherwise TADOQuery does not know to who performs the query, and then use the results of a query on the TDataSource, there will be results stored in TDataSource, but to show it to connect TDataSource and TDRGrid. So according to this process we configuration: The first selection in the second step, on the left, click on the red circle in the button in the pop-up dialog box, as shown in Figure third step, third step you are in front of your Conn.udl file, and we should pay attention to in the LoginPrompt property right to choose the False, otherwise the program will run constantly remind password very entanglements the.
The mouse in the first step, and then ADOConnection1 second step Connection selection in this step is and it together, and then the third step, is SQL tell TADOQuer you want to query, and then click the OK button.

The configuration of DataSource1
Then you have to put the results in TDBGrid, the field name you want in the control to create you want to display, First select the first step (attention, your program in figure in the black ring 1 without Account and PassWord, because you have not done this, do not ignore it, you said as I go down), and then choose our previous DataSource1 in 2, finished we'll add the Account and PassWord2 columns of data.

The first step to double-click, will pop up dialog box click the second step, second step position, then is in the position input field names the third step, you search out the results you want displayed field. We repeat the 2,3 the Account and PassWord are added, OK, if your TDBGrid or nothing, you confirm that you set the Active property in the 4 component is True.

Be accomplished.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Allen at December 05, 2013 - 6:03 PM