Page 296 - Open Soource Technologies 304.indd
P. 296

Event Driven Programming






























                                                       Figure 13.9: MyCommand.
                          In order to use SQL command, right-click
                          MyCommand and you can see its properties
                          dialog. At the General tab, select SQL statement
                          and key in the following SQL statement:
                          SELECT Au_ID, Author
                          FROM Authors ORDER BY Author
                          This command is to select all the fields from the
                          Authors table in the Biblio.Mdb database. The
                          command ORDER BY Author is to arrange the list
                          in ascending order according to the Authors’
                          Names.
                          Now, you need to customize a few properties of
                          your data report so that it can connect to the
                          database. The first property to set is the DataSource,
                          set it to MyDataEnvironment. Next, you need to
                          set the DataMember property to MyCommand,as
                          shown in Figure 13.10.

                          To add  data to your report, you need to drag the
                          fields from MyCommand in MyDataEnvironment
                          into MyDataReport, as shown in Figure 13.11.Visual
                          Basic 6 will automatically draw a RptTextBox, along
                          with a RptLabel control for each field on the report.
                          You can customize the look of the labels as well
                          as the TextBoxes from the properties window of
                          MyDataReport.
                                                                            Figure 13.10: Properties.




                          290                    LOVELY PROFESSIONAL UNIVERSITY
   291   292   293   294   295   296   297   298   299   300   301