Overview of Migrating ICursor-Based ActiveX Controls to OLE DB
The complexity of the conversion process varies based on design and implementation techniques used for a particular control. For the most part, you can expect to make modifications in the following areas:
-
Row fetching and data caching code. You’ll spend most of your time in this area because of the major difference between the two data access methods.
-
Updating row data, adding and deleting rows. This area also may require some effort.
-
Column information and bindings. The concept is the same between the two, so conversion should not be difficult.
-
Notification handling. Nearly all ICursor type events have an OLE DB equivalent. This is facilitated by OLE DB's organized approach to notifications.
You can expect very little change in:
-
How your control behaves from a user’s point of view. Your non-data-bind properties virtually remain the same. The control's user interface should not change.
-
Your paint routines. If they are encapsulated properly from the start, the routines should remain intact.
Considerations Before Migrating
Migrating an existing ICursor-based ActiveX control to OLE DB requires that you understand:
-
How rowsets are consumed (see Chapter 1, “Consuming Rowsets” for more information).
-
Basic differences between simple and complex controls (see Chapters 2 and 3).
-
Which OLE DB interfaces provide the same functionality as their ICursor equivalents (see “Interface Mapping Reference” later in this chapter).
Before proceeding, you may want to review the samples shipped with this SDK. Experiment with them to get accustomed to using OLE DB before starting your migration. It may be helpful to look for similarities in the way your existing control and the samples handle data access.
Once you’ve reviewed the samples, you have to decide whether to migrate or rewrite your control. If you decide to migrate, you may want to go through your existing code, and restructure and redesign it to make migration easier. This means removing any ICursor-dependent code from code sections you want to keep.