Writing Your Own Customized Handler

Microsoft ActiveX Data Objects (ADO)

RDS 2.5

Writing Your Own Customized Handler

You may want to write your own handler if you are an IIS server administrator who wants the default RDS support, but more control over user requests and access rights.

The MSDFMAP.Handler implements the IDataFactoryHandler interface.

IDataFactoryHandler Interface

This interface has two methods, GetRecordset and Reconnect. Both methods require that the CursorLocation property be set to adUseClient.

Both methods take arguments that appear after the first comma in the "Handler=" keyword. For example, "Handler=progid,arg1,arg2;" will pass an argument string of "arg1,arg2", and "Handler=progid" will pass a null argument.

GetRecordset Method

This method queries the data source and creates a new Recordset object using the arguments provided. The Recordset must be opened with adLockBatchOptimistic and must not be opened asynchronously.

Arguments

conn The connection string.

args The arguments for the handler.

query The command text for making a query.

ppRS The pointer where the Recordset should be returned.

Reconnect Method

This method updates the data source. It creates a new Connection object and attaches the given Recordset.

Arguments

conn The connection string.

args The arguments for the handler.

pRS A Recordset object.

msdfhdl.idl

This is the interface definition for IDataFactoryHandler that appears in the msdfhdl.idl file.

[
  uuid(D80DE8B3-0001-11d1-91E6-00C04FBBBFB3),
  version(1.0)
]
library MSDFHDL
{
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");

    // TLib : Microsoft ActiveX Data Objects 2.0 Library
    // {00000200-0000-0010-8000-00AA006D2EA4}
    #ifdef IMPLIB
    importlib("implib\\x86\\release\\ado\\msado15.dll");
    #else
    importlib("msado20.dll");
    #endif

    [
      odl,
      uuid(D80DE8B5-0001-11d1-91E6-00C04FBBBFB3),
      version(1.0)
    ]
    interface IDataFactoryHandler : IUnknown
    {
HRESULT _stdcall GetRecordset(
      [in] BSTR conn,
      [in] BSTR args,
      [in] BSTR query,
      [out, retval] _Recordset **ppRS);

// DataFactory will use the ActiveConnection property
// on the Recordset after calling Reconnect.
   HRESULT _stdcall Reconnect(
      [in] BSTR conn,
      [in] BSTR args,
      [in] _Recordset *pRS);
    };
};

See Also

Customization File Connect Section | Customization File Logs Section | Customization File SQL Section | Customization File UserList Section | DataFactory Customization | Required Client Settings | Understanding the Customization File

© 1998-2003 Microsoft Corporation. All rights reserved.