Page 521 - Microsoft Office Excel 2003 Programming Inside Out
P. 521

Introducing ADO

                             The Name property contains the name of the column as it was defined in the database or
                             the Select statement that returned the rows. The Type property describes the OLE DB type of
                             the column.
                             There are several different properties containing the value of the column in the Field object.
                             The Value property represents the current value of the column as seen by the application
                             program. If your program doesn’t explicitly change the Value property, it will have the same
                             value as found in the OriginalValue property. The OriginalValue property always contains the
                             value of the column when it was originally retrieved from the database.
                             On the other hand, the UnderlyingValue property contains the most recent value of the column
                             stored in the database. Because it’s possible that the database has been updated since the orig­
                             inal Recordset object was created, you can use the UnderlyingValue property to go back to the
                             database to get a fresh copy of the column.

                             Note  Use the UnderlyingValue property carefully; it forces ADO to go back to the data-
                             base to get the most current value. Although it’s OK to do this every now and then, perform­
                             ing this action repetitively can have an adverse impact on your application’s performance.

                             In this chapter, you learned about the key objects that comprise the ADO architecture. Each
                             of three main objects performs a specific task. The Connection object contains the informa­
                             tion necessary for your application to communicate with a database server. The Connection
                             object also contains the Errors collection, which describes the most recent error encountered
                             while using ADO. The Command object describes an SQL statement that will be executed,
                             including the collection of Parameter objects that will be passed to the command for execu­
                             tion. Finally, the Recordset object provides access to data that may be returned by executing a
                             Command object, with the individual values associated with each returned row being
                             exposed through the Fields collection and each individual column being exposed through the
                             Field object.





                                                                                                             Chapter 23



















                                                                                                       495
                                                                        Part 6:  Excel and the Outside World: Collaborating Made Easy
   516   517   518   519   520   521   522   523   524   525   526