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

Event Driven Programming



                          10.5.7 Common Language Runtime Integration

                          The details of this are beyond the scope of this article, but it’s also worth noting that with
                          SQL Server 2005, we can build DLLs that run inside of SQL Server. This lets we implement
                          triggers, stored procedures, user-defined functions, and so, using languages such as Visual Basic
                          or Visual C#.


                                        Structured Query Language (usually referred to as SQL) is the language we
                                        use to specify the data included in a Record set. It can also provide we with
                                        the vehicle for specifying changes to data through the Database object’s Execute
                                        method.










                           Connecting to an Access Database Using the VB Data Control

                           Steps
                            1. Open a new Visual Basic project.
                            2. Put a data control (an intrinsic control, located in the VB toolbox) on the form and set
                               the properties as follows:


                                        Property                Value
                                        (Name)                  datAuthors

                                        Caption                 Use the arrows to view the data

                                        Connect                 Access  (default)

                                        DatabaseName            ..\biblio.mdb

                                        DefaultType             UseJet  (default)
                                        RecordSource            Authors  (choose from list)


                                        When we use the Data Control in a project, the properties that must be set
                                        are DatabaseName and RecordSource, in that order. DatabaseName is the
                                        name of the database we want to use, and the RecordSource is the name of
                                        the table in that database that we want to use.


                            3. On form, create a text box for each field in the table, with labels. Set the properties of
                               the three textboxes as follows:




                          238                    LOVELY PROFESSIONAL UNIVERSITY
   239   240   241   242   243   244   245   246   247   248   249