Page 274 - DCAP408_WEB_PROGRAMMING
P. 274

Web Programming




                    Notes          Set the CursorType property prior to opening the Recordset to choose the cursor type, or pass a
                                   CursorType argument with the Open method. Some providers don’t support all cursor types.
                                   Check the documentation for the provider. If you don’t specify a cursor type, ADO opens a
                                   forward-only cursor by default.
                                   If the CursorLocation property is set to adUseClient to open a Recordset, the UnderlyingValue
                                   property on Field objects is not available in the returned Recordset object. When used with some
                                   providers (such as the Microsoft ODBC Provider for OLE DB in conjunction with Microsoft SQL
                                   Server), you can create Recordset  objects independently of a previously defined Connection
                                   object by passing a connection string with the Open method. ADO still creates a Connection
                                   object,  but it doesn’t assign that object  to an  object variable.  However, if you are  opening
                                   multiple Recordset objects over the same connection, you should explicitly create and open a
                                   Connection object; this assigns the Connection object to an object variable.




                                     Notes   If you do not use this object variable when opening your Recordset objects, ADO
                                     creates a  new Connection object for each  new  Recordset, even  if you  pass the  same
                                     connection string.

                                   12.1.1 CursorType Property

                                   Indicates the type of cursor used in a Recordset object.

                                   Settings and Return Values

                                   Sets or returns a CursorTypeEnum value. The default value is adOpenForwardOnly.

                                   Remarks

                                   Use the CursorType property to specify the type of cursor that should be used when opening the
                                   Recordset object.
                                   Only a setting of adOpenStatic is supported if the CursorLocation property is set to adUseClient.
                                   If an unsupported value is set, then no error will result; the closest supported CursorType will
                                   be used instead.
                                   If a provider does not support the requested cursor type, it may return another cursor type. The
                                   CursorType property will change to match the actual cursor type in use when the Recordset
                                   object is open. To verify specific functionality of the returned cursor, use the Supports method.
                                   After you close the Recordset, the CursorType property reverts to its original setting.
                                   The following chart shows the provider functionality (identified by Supports method constants)
                                   required for each cursor type.


                                     For a Recordset of this CursorType   The Supports method must return True for all of these constants
                                     adOpenForwardOnly           None
                                     AdOpenKeyset                adBookmark, adHoldRecords, adMovePrevious, adResync
                                     adOpenDynamic               AdMovePrevious
                                     AdOpenStatic                adBookmark, adHoldRecords, adMovePrevious, adResync







          268                               LOVELY PROFESSIONAL UNIVERSITY
   269   270   271   272   273   274   275   276   277   278   279