RDS 2.7 API Reference

Handler Property Example (VB)

This example demonstrates the RDS DataControl object Handler property. (See DataFactory Customization for more details.)

Assume that the following sections in the parameter file, Msdfmap.ini, are located on the server:

[connect AuthorDataBase]
Access=ReadWrite
Connect="DSN=Pubs"
[sql AuthorById]
SQL="SELECT * FROM Authors WHERE au_id = ?"

Your code looks like the following. The command assigned to the SQL property will match the AuthorById identifier and will retrieve a row for author Michael O'Leary. The DataControl object Recordset property is assigned to a disconnected Recordset object purely as a coding convenience.

'BeginHandlerVB
Public Sub HandlerX()
Dim dc As New DataControl
Dim rst As ADODB.Recordset

dc.Handler = "MSDFMAP.Handler"
dc.ExecuteOptions = 1
dc.FetchOptions = 1
dc.Server = "http://YourServer"
dc.Connect = "Data Source=AuthorDataBase"
dc.SQL = "AuthorById('267-41-2394')"
dc.Refresh                  'Retrieve the record
Set rst = dc.Recordset      'Use another Recordset as a convenience
Debug.Print "Author is '" & rst!au_fname & " " & rst!au_lname & "'"

End Sub
'EndHandlerVB

See Also

DataControl Object (RDS) | Handler Property (RDS)

© 1998-2001 Microsoft Corporation. All rights reserved.