ADO: ActiveX Data Objects

Book description

Getting data across platforms and formats is a cornerstone of present-day applications development. ADO: ActiveX Data Objects is both an introduction and a complete reference to ADO (ActiveX Data Objects), Microsoft's universal data access solution. You'll learn how to easily access data in multiple formats--such as email messages, Access databases, Word documents, and SQL databases--even on different platforms, without spending extra time learning every last detail about each format.Author Jason Roff shows by example how to use ADO with your programming language of choice to save programming time, so you can concentrate on the content and quality of your application rather than the nitty-gritty of specific data formats.ADO: ActiveX Data Objects includes:

  • Chapters dedicated to the Connection, Recordset, Field, and Command objects and the Properties collection
  • A complete, detailed reference listing every ADO object, method, property, and event, in convenient alphabetical order
  • Chapters on ADO architecture, data shaping, the ADO Event Model
  • An appendix containing enumeration tables used by ADO objects and collections, listed alphabetically
  • Brief introductions to RDS, ADO.NET, and SQL
ADO: ActiveX Data Objects is a versatile one-stop guide to both the theory and practice of programming with ADO through Version 2.6. The thorough reference section and topic-specific chapters will help you find quick answers about the details of objects, collections, methods, and properties of ADO. And the abundance of practical code examples will give you a good grasp of how to use ADO's strong points most effectively.

Publisher resources

View/Submit Errata

Table of contents

  1. ADO: ActiveX Data Objects
  2. A Note Regarding Supplemental Files
  3. Preface
    1. Introduction and Organization
      1. Part I: Learning ADO
      2. Part II: Reference Section
      3. Part III: Appendixes
      4. About the Book
      5. Audience
    2. Conventions Used in This Book
    3. Comments and Questions
    4. Acknowledgments
  4. I. Learning ADO
    1. 1. Introduction to ADO
      1. ADO in Context: Universal Data Access
        1. ODBC
          1. Jet/DAO
          2. RDO
          3. ODBCDirect
        2. OLE DB
        3. ADO
        4. RDS
        5. Putting It All Together
      2. ADO and COM: Language Independence
        1. COM
        2. ADO and COM
      3. When to Use ADO
      4. Summary
    2. 2. The ADO Architecture
      1. An Overview of the ADO Architecture
      2. ADO Components
        1. The Connection Object
        2. The Command Object
          1. The Parameters collection and the Parameter object
        3. The Recordset Object
          1. The Fields collection and the Field object
        4. The Record Object
        5. The Stream Object
        6. The Properties Collection and the Property Object
        7. The Errors Collection and the Error Object
      3. Summary
    3. 3. Accessing ADO with Various Languages
      1. Accessing ADO with Visual Basic
        1. Referencing ActiveX Data Objects
        2. Creating ActiveX Data Objects
        3. Using ADO with Visual Basic: An Example
      2. Accessing ADO with Visual C++
        1. Referencing ActiveX Data Objects
        2. Creating ActiveX Data Objects
        3. Using ADO with Visual C++: An Example
      3. Accessing ADO with Visual J++
        1. Referencing ActiveX Data Objects
        2. Creating ActiveX Data Objects
        3. Using ADO with Visual J++: An Example
      4. Accessing ADO with VBScript
        1. Referencing ActiveX Data Objects
        2. Creating ActiveX Data Objects
        3. Using ADO with VBScript: An Example
      5. Accessing ADO with JScript
        1. Referencing ActiveX Data Objects
        2. Creating ActiveX Data Objects
        3. Using ADO with JScript: An Example
      6. Summary
    4. 4. The Connection Object
      1. Opening and Closing a Connection: Implicit Versus Explicit
        1. Opening a Connection
        2. Closing a Connection
      2. Configuring Connections
        1. Working with Connection Strings
        2. Working with Data Source Names
          1. Installing the DSNs
          2. Opening a connection with a DSN
        3. Setting Connection Options
          1. Default database
          2. Data-access permissions
          3. Timeout setting
          4. Cursor location
        4. Determining ADO Version Number and Connection State
      3. Choosing a Data Provider
      4. Executing Commands
        1. The Execute Method
        2. The CommandTimeout Property
      5. Managing Multiple Transactions
        1. Starting a Transaction: The BeginTrans and CommitTrans Methods
        2. Canceling a Transaction: The RollbackTrans Method
        3. Nesting Transactions
        4. Setting Transaction Options
          1. Automatic creation of new transactions
          2. Isolation level
      6. Determining the Layout of Your Data Source
      7. Summary
    5. 5. The Recordset Object
      1. Cursors: Viewing a Recordset
        1. Dynamic Cursor
        2. Keyset Cursor
        3. Static Cursor
        4. Forward-Only Cursor
        5. CursorType Example
      2. Working with Recordsets
        1. The Open Method
        2. The Save Method
        3. Determining the State of the Recordset Object: The State Property
        4. Fine-Tuning Performance of the Recordset Object
          1. The CacheSize property
          2. The MaxRecords property
          3. The CursorLocation property
        5. Sorting, Filtering, and Finding Rows in a Recordset
          1. The Filter property
          2. The Sort property
          3. The Resync method
          4. The Find method
        6. Working with Multiple Recordset Objects
      3. Navigating a Recordset
        1. The Record Pointer
        2. The MoveFirst, MovePrevious, MoveNext, and MoveLast Methods
        3. The Move Example
        4. Ordinal Position
        5. Bookmarks
          1. The Move method
        6. Paging
      4. Working with Records
        1. Adding New Records
        2. Updating and Editing Records
        3. Deleting Records
        4. Retrieving Records
      5. Lock Types: Managing Access to a Recordset
        1. Read-Only Locks
        2. Pessimistic Locks
        3. Optimistic Locks
        4. Batch Optimistic Locks
      6. Summary
    6. 6. Fields
      1. The Fields Collection Object
        1. The Field Object
        2. Working with the Fields Collection
      2. Field Specifics
        1. Field Datatypes
        2. Field Sizes
        3. Large Datatypes
        4. Batch Updates
      3. Determining Field Object Functionality
      4. Summary
    7. 7. The Command Object
      1. Specifying Commands
        1. Textual Definitions as Commands
        2. Stored Procedures as Commands
        3. Table Names as Commands
        4. Unknown Command Types
      2. Executing Commands
        1. Executing Commands with the Command Object
        2. Executing Commands with the Connection Object
        3. Executing Commands with the Recordset Object
      3. Parameters
        1. Passing Parameters
        2. Parameter Properties
        3. Specifying Parameters
      4. The Parameters Project
      5. Asynchronous Execution
        1. Executing a Command Asynchronously
        2. Canceling a Command
      6. Summary
    8. 8. The ADO Event Model
      1. Introduction to Events
      2. The ConnectionEvent Family
        1. Connection Events
        2. Execution Events
        3. Transaction Events
        4. Informational Events
      3. The RecordsetEvent Family
        1. Retrieval Events
        2. Movement Events
        3. Field Change Events
        4. Record Change Events
        5. Recordset Change Events
      4. Canceling Operations
      5. Turning Events Off
      6. Summary
    9. 9. Data Shaping
      1. An Introduction to Data Shaping
      2. The Microsoft Data Shaping Service
      3. Shaping Commands
        1. APPEND Command
        2. COMPUTE Command
        3. Shape Functions
      4. Example: Accessing Shaped Recordsets
      5. Summary
    10. 10. Records and Streams
      1. The Record Object
        1. Opening a Record Object
          1. Opening a Record object with a Command object
          2. Opening a Record object with a SQL statement
          3. Opening a Record object with a table name
          4. Opening a Record object with an open Recordset object
          5. Opening a Record object with a URL
        2. Navigating Hierarchies
        3. File and Directory Manipulation with the Record Object
          1. Copying
          2. Deleting
          3. Moving
        4. Record Object Properties
        5. Record Object Fields
          1. Internet Publishing provider fields
          2. Standard Record object fields
      2. The Stream Object
        1. Opening a Stream Object
          1. Obtaining a Stream with the Default Stream from a Record object
          2. Opening a Stream with an open Record object
          3. Opening a Stream with an absolute URL
          4. Opening a Stream in memory
        2. Reading and Writing with Streams
          1. Textual data
          2. Binary data
          3. Stream persistence
      3. Summary
    11. 11. Remote Data Services
      1. RDS Object Model
        1. The DataSpace Object
          1. DataSpace object members
          2. Instantiating an object with the DataSpace object
        2. The DataFactory Object
          1. DataFactory object members
          2. Creating an empty recordset on the client side
          3. Roundtrip querying and updating
        3. The DataControl Object
          1. DataControl object members
          2. Binding a control to the DataControl object
          3. Filtering and sorting the recordset
      2. An Example in RDS
      3. More Information About RDS
      4. Summary
    12. 12. The Microsoft .NET Framework and ADO.NET
      1. The Microsoft .NET Framework
        1. The Common Language Runtime
        2. C#: Unified Programming Language
        3. ASP.NET
        4. From COM to .NET: The Creation of ADO.NET
      2. ADO.NET
        1. DataSets
        2. Managed Providers
      3. ADO.NET Features
        1. Disconnected Data
        2. Strongly Typed Language
        3. XML Integration
      4. Summary
  5. II. Reference Section
    1. 13. ADO API Reference
      1. Finding the Reference Page
      2. Using the Reference Pages
        1. Sample Object
        2. Sample Object.Property
        3. Sample Object.Method
        4. Command Object
        5. Command.ActiveConnection Property
        6. Command.Cancel Method
        7. Command.CommandStream Property
        8. Command.CommandText Property
        9. Command.CommandTimeout Property
        10. Command.CommandType Property
        11. Command.CreateParameter Method
        12. Command.Dialect Property
        13. Command.Execute Method
        14. Command.Name Property
        15. Command.NamedParameters Property
        16. Command.Parameters Collection
        17. Command.Prepared Property
        18. Command.Properties Collection
        19. Command.State Property
        20. Connection Object
        21. Connection.Attributes Property
        22. Connection.BeginTrans Method, Connection.CommitTrans Method, Connection.RollbackTrans Method
        23. Connection.BeginTransComplete Event
        24. Connection.Cancel Method
        25. Connection.Close Method
        26. Connection.CommandTimeout Property
        27. Connection.CommitTrans Method
        28. Connection.CommitTransComplete Event
        29. Connection.ConnectComplete Event
        30. Connection.ConnectionString Property
        31. Connection.ConnectionTimeout Property
        32. Connection.CursorLocation Property
        33. Connection.DefaultDatabase Property
        34. Connection.Disconnect Event
        35. Connection.Errors Collection
        36. Connection.Execute Method
        37. Connection.ExecuteComplete Event
        38. Connection.InfoMessage Event
        39. Connection.IsolationLevel Property
        40. Connection.Mode Property
        41. Connection.Open Method
        42. Connection.OpenSchema
        43. Connection.Properties Collection
        44. Connection.Provider Property
        45. Connection.RollbackTrans Method
        46. Connection.RollbackTransComplete Event
        47. Connection.State Property
        48. Connection.Version Property
        49. Connection.WillConnect Event
        50. Connection.WillExecute Event
        51. Error Object
        52. Error.Description Property
        53. Error.HelpContext Property (Versions 2.0, 2.1, 2.5, 2.6)Error.HelpFile Property
        54. Error.NativeError Property
        55. Error.Number Property
        56. Error.Source Property
        57. Error.SQLState Property
        58. Errors Collection
        59. Errors.Clear Method
        60. Errors.Count Property
        61. Errors.Item Property
        62. Errors.Refresh Method
        63. Field Object
        64. Field.ActualSize Property
        65. Field.AppendChunk
        66. Field.Attributes Property
        67. Field.DataFormat Property
        68. Field.DefinedSize Property
        69. Field.GetChunk Method
        70. Field.Name Property
        71. Field.NumericScale Property
        72. Field.OriginalValue Property
        73. Field.Precision Property
        74. Field.Properties Collection
        75. Field.Status Property
        76. Field.Type Property
        77. Field.UnderlyingValue Property
        78. Field.Value Property
        79. Fields Collection
        80. Fields.Append Method
        81. Fields.CancelUpdate Method
        82. Fields.Count Property
        83. Fields.Delete Method
        84. Fields.Item Property
        85. Fields.Refresh Method
        86. Fields.Resync Method
        87. Fields.Update Method
        88. Parameter Object
        89. Parameter.AppendChunk Method
        90. Parameter.Attributes Property
        91. Parameter.Direction Property
        92. Parameter.Name Property
        93. Parameter.NumericScale Property
        94. Parameter.Precision Property
        95. Parameter.Properties Collection
        96. Parameter.Size Property
        97. Parameter.Type Property
        98. Parameter.Value Property
        99. Parameters Collection
        100. Parameters.Append Method
        101. Parameters.Count Property
        102. Parameters.Delete Method
        103. Parameters.Item Property
        104. Parameters.Refresh Method
        105. Properties Collection
        106. Properties.Count Property
        107. Properties.Item Property
        108. Properties.Refresh Method
        109. Property Object
        110. Property.Attributes Property
        111. Property.Name Property
        112. Property.Type Property
        113. Property.Value Property
        114. Record Object
        115. Record.ActiveConnection Property
        116. Record.Cancel Method
        117. Record.Close Method
        118. Record.CopyRecord Method
        119. Record.DeleteRecord Method
        120. Record.Fields Collection
        121. Record.GetChildren Method
        122. Record.Mode Property
        123. Record.MoveRecord Method
        124. Record.Open Method
        125. Record.ParentURL Property
        126. Record.Properties Collection
        127. Record.RecordType Property
        128. Record.Source Property
        129. Record.State Property
        130. Recordset Object
        131. Recordset.AbsolutePage Property
        132. Recordset.AbsolutePosition Property
        133. Recordset.ActiveCommand Property
        134. Recordset.ActiveConnection Property
        135. Recordset.AddNew Method
        136. Recordset.BOF Property (Versions 2.0, 2.1, 2.5, 2.6)Recordset.EOF Property
        137. Recordset.Bookmark Property
        138. Recordset.CacheSize Property
        139. Recordset.Cancel Method
        140. Recordset.CancelBatch Method
        141. Recordset.CancelUpdate Method
        142. Recordset.Clone Method
        143. Recordset.Close Method
        144. Recordset.CompareBookmarks Method
        145. Recordset.CursorLocation Property
        146. Recordset.CursorType Property
        147. Recordset.DataMember Property, Recordset.DataSource Property
        148. Recordset.Delete Method
        149. Recordset.EditMode Property
        150. Recordset.EndOfRecordset Event
        151. Recordset.EOF Property
        152. Recordset.FetchComplete Event
        153. Recordset.FetchProgress Event
        154. Recordset.FieldChangeComplete Event
        155. Recordset.Fields Collection
        156. Recordset.Filter Property
        157. Recordset.Find Method
        158. Recordset.GetRows Method
        159. Recordset.GetString Method
        160. Recordset.Index Property
        161. Recordset.LockType Property
        162. Recordset.MarshalOptions Property
        163. Recordset.MaxRecords Property
        164. Recordset.Move Method
        165. Recordset.MoveComplete Event
        166. Recordset.MoveFirst Method, Recordset.MoveLast Method, Recordset.MoveNext Method, Recordset.MovePrevious Method
        167. Recordset.NextRecordset Method
        168. Recordset.Open Method
        169. Recordset.PageCount Property
        170. Recordset.PageSize Property
        171. Recordset.Properties Collection
        172. Recordset.RecordChangeComplete Event
        173. Recordset.RecordsetChangeComplete Event
        174. Recordset.RecordCount Property
        175. Recordset.Requery Method
        176. Recordset.Resync Method
        177. Recordset.Save Method
        178. Recordset.Seek Method
        179. Recordset.Sort Property
        180. Recordset.Source Property
        181. Recordset.State Property
        182. Recordset.Status Property
        183. Recordset.StayInSync Property
        184. Recordset.Supports Method
        185. Recordset.Update Method
        186. Recordset.UpdateBatch Method
        187. Recordset.WillChangeField Event
        188. Recordset.WillChangeRecord Event
        189. Recordset.WillChangeRecordset Event
        190. Recordset.WillMove Event
        191. Stream Object
        192. Stream.Cancel Method
        193. Stream.CharSet Property
        194. Stream.Close Method
        195. Stream.CopyTo Method
        196. Stream.EOS Property
        197. Stream.Flush Method
        198. Stream.LineSeparator Property
        199. Stream.LoadFromFile Method
        200. Stream.Mode Property
        201. Stream.Open Method
        202. Stream.Position Property
        203. Stream.Read Method
        204. Stream.ReadText Method
        205. Stream.SaveToFile Method
        206. Stream.SetEOS Method
        207. Stream.Size Property
        208. Stream.SkipLine Method
        209. Stream.State Property
        210. Stream.Type Property
        211. Stream.Write Method
        212. Stream.WriteText Method
  6. III. Appendixes
    1. A. Introduction to SQL
      1. Record Selection
        1. Selection Statements
          1. SELECT
          2. SELECT ALL
          3. SELECT DISTINCT
          4. SELECT DISTINCTROW
          5. SELECT TOP
        2. Aggregate Functions
          1. AVG
          2. COUNT
          3. MIN and MAX
          4. STDEV and STDEVP
          5. SUM
          6. VAR and VARP
        3. Setting Conditions
          1. WHERE
          2. WHERE
        4. Grouping and Ordering
          1. GROUP BY
          2. HAVING
          3. ORDER BY
          4. SELECT TOP
        5. Joining Tables
          1. INNER JOIN
          2. LEFT JOIN and RIGHT JOIN
          3. SELECT DISTINCTROW
        6. Subqueries
        7. Unions
          1. UNION
        8. Other Options
          1. PARAMETERS
          2. PROCEDURE
          3. WITH OWNERACCESS OPTION
      2. Data Manipulation
        1. Adding Records
          1. INSERT . . . INTO
        2. Modifying Records
          1. UPDATE
        3. Deleting Records
          1. DELETE
      3. Database Modification
        1. CREATE TABLE
        2. ALTER TABLE
        3. CONSTRAINT
        4. CREATE INDEX
        5. DROP
    2. B. The Properties Collection
      1. The Property Example
    3. C. ADO Errors
      1. Working with Errors in ADO
        1. ADO Trappable Errors
        2. Data-Provider Errors
      2. The Errors Example
        1. The Main Form
        2. The ADO Error(s) Form
    4. D. The ADO Data Control
      1. The ADO Data Control Property Pages
      2. Creating Connection Strings with the ADO Data Control
        1. Data Link Properties Dialog Box
          1. Entering provider information
          2. Entering connection information
            1. The Jet providers
            2. The ODBC provider
            3. The SQL Server providers
            4. The Oracle providers
            5. Other OLE DB providers
          3. Entering advanced information
            1. Impersonation level
            2. Protection level
            3. Connection timeout
            4. Access permissions
          4. Reviewing all of the Data Link information
        2. Data Link Files
      3. The ADO Data Control Example
    5. E. Enumeration Tables
      1. ADCPROP_ASYNCTHREADPRIORITY_ENUM Enumeration
      2. ADCPROP_AUTORECALC_ENUM Enumeration
      3. ADCPROP_UPDATECRITERIA_ENUM Enumeration
      4. ADCPROP_UPDATERESYNC_ENUM Enumeration
      5. AffectEnum Enumeration
      6. BookmarkEnum Enumeration
      7. CommandTypeEnum Enumeration
      8. CompareEnum Enumeration
      9. ConnectModeEnum Enumeration
      10. ConnectOptionEnum Enumeration
      11. ConnectPromptEnum Enumeration
      12. CopyRecordOptionsEnum Enumeration
      13. CursorLocationEnum Enumeration
      14. CursorOptionEnum Enumeration
      15. CursorTypeEnum Enumeration
      16. DataTypeEnum Enumeration
      17. EditModeEnum Enumeration
      18. ErrorValueEnum Enumeration
      19. EventReasonEnum
      20. EventStatusEnum Enumeration
      21. ExecuteOptionEnum Enumeration
      22. FieldAttributesEnum Enumeration
      23. FieldEnum Enumeration
      24. FieldStatusEnum Enumeration
      25. FilterGroupEnum Enumeration
      26. GetRowsOptionEnum Enumeration
      27. IsolationLevelEnum Enumeration
      28. LineSeparatorEnum Enumeration
      29. LockTypeEnum Enumeration
      30. MarshalOptionsEnum Enumeration
      31. MoveRecordOptionsEnum Enumeration
      32. ObjectStateEnum Enumeration
      33. ParameterAttributesEnum Enumeration
      34. ParameterDirectionEnum Enumeration
      35. PersistFormatEnum Enumeration
      36. PositionEnum Enumeration
      37. PropertyAttributesEnum Enumeration
      38. RecordCreateOptionsEnum Enumeration
      39. RecordOpenOptionsEnum Enumeration
      40. RecordStatusEnum Enumeration
      41. RecordTypeEnum Enumeration
      42. ResyncEnum Enumeration
      43. SaveOptionsEnum Enumeration
      44. SchemaEnum Enumeration
      45. SearchDirectionEnum Enumeration
      46. SeekEnum Enumeration
      47. StreamOpenOptionsEnum Enumeration
      48. StreamReadEnum Enumeration
      49. StreamTypeEnum Enumeration
      50. StreamWriteEnum Enumeration
      51. StringFormatEnum Enumeration
      52. XactAttributeEnum Enumeration
  7. Index
  8. Colophon
  9. Copyright

Product information

  • Title: ADO: ActiveX Data Objects
  • Author(s): Jason T Roff
  • Release date: June 2001
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491935569