Article ID: 183294 - Last Review: May 17, 2007 - Revision: 6.4 INFO: Techniques for Returning a Recordset Through RDSThis article was previously published under Q183294 On This PageSUMMARY
There are several techniques for returning data in a disconnected recordset
using the Remote Data Service (RDS). There are two objects on the client,
the RDS.DataControl and RDS.DataSpace, and one object on a server,
RDSServer.DataFactory, which you can manipulate in different ways to
generate a recordset, and to submit changes made to the data it contains.
The correct method for your application depends upon the design and
functionality you want.
MORE INFORMATION
The Remote Data Service allows you to remote an ActiveX Data Objects (ADO)
Recordset across HTTP, HTTPS or DCOM to a client computer. If using the HTTP/HTTPS protocal it assumes that you have a server running either Internet Information Server 3.0 (or greater),
or Personal Web Server. In either case, you will have installed the RDS Server components on that server. The client computer requires the RDS components, and the client application can be written in any
language that supports COM and manipulation of COM Objects (C++, Java,
Visual Basic For Applications, VBScript, and so forth). There are two types of ADO Recordsets that you see used in conjunction with RDS. The ADODB recordset comes from Msado15.dll, and is part of the entire ADO object hierarchy. However, when marshalling a recordset across the wire, in order to provide a thin client, (minimal DLL's and memory footprint), RDS converts that recordset into an ADOR recordset. ADOR (from Msado15r.dll) comes without the rest of the ADO object model. For the purposes of this discussion (as well as any code you write) ADOR.Recordset and ADODB.Recordset are synonymous. You should reference ADOR.Recordset in your client application and whether you use ADOR.Recordset or ADODB.Recordset in your server-side custom business object is irrelevant. However, if you use ADODB, you can use the Connection and Command objects which offer functionality not available just opening a recordset "stand- alone." Technique #1 - The DataControlYou can use the RDS.DataControl to retrieve a recordset from the RDS Server via the Refresh method. You could also assign an existing recordset to the SourceRecordset property.Within the Active Server Pages page (ASP) environment, you can bind graphical controls to the RDS.DataControl. Whether in ASP or any other development environment, you can easily use the RDS.DataControl programmatically to retrieve, sort, and filter data. Most of the properties and methods of the DataControl resemble a subset of the ADO Recordset (either ADOR or ADODB.) The RDS.DataControl also offers asynchronous processing that is currently not offered within ADO 1.5. With the release of ADO 2.0 asynchronous processing is available. The RDS.DataControl uses a business object on the server, provided by RDS, called the RDSServer.DataFactory. The DataFactory generates a recordset and also receives changes made to the data it contains. You cannot override (directly) the DataControl to use a different business object. The following code demonstrates this technique using Visual Basic for Applications: Technique #2 - Using the DataSpace with the Default Business ObjectYou may use the RDS.Dataspace object to invoke a business object on the server. If you provide the ProgID of the default business object (RDSServer.DataFactory), then you use the business object that RDS provides for you. This business object can provide a Recorsdet, but offers no conflict resolution (or any information) regarding a failure if the changes you post to the data are not accepted.The following code demonstrates this technique using VBA: Technique #3 - Using the DataSpace to a Custom Business ObjectA business object is nothing more than an ActiveX DLL registered on the RDS Server (and perhaps on the client, if you are using DCOM as your protocol). The advantage of this technique is that you can implement conflict resolution, data validation or other functionality within your business object.There are three protocols you can use to marshall a recordset to the client, HTTP, HTTPS, and DCOM. When using a custom business object you must add a registry setting to the server where the business object is registered. In the following example the VBCustBusObj.OBJ would need to be added to the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services \W3SVC\Parameters\ADCLaunch\VBCustBusObj.OBJ The following code demonstrates this technique using VBA: Technique #4 - Using the MS Remote ProviderStarting with RDS 2.0, you can use the MS Remote provider along with standard ADO code to return an RDS recordset. The advantage is that you may use ADO code similar to the code you would use with any other provider; the only difference is the connection string. Although your code looks like ADO, it is actually using RDS. So, you must use clientside recordsets with the MS Remote provider.The connection string for the MS Remote provider must specify the following:
Provider MS Remote
------------------------------------------------
Remote Server Server that you want to process your requests
Remote Provider Provider that you want the server to use
(The default is the OLE DB Provider for ODBC)
REFERENCES
You can find the latest documentation on RDS at the following site:
http://msdn.microsoft.com/en-us/library/ms811713.aspx
(http://msdn.microsoft.com/en-us/library/ms811713.aspx)
You can download the latest version of the Microsoft Data Access Components, including the Remote Data Services, from the following site:
http://msdn2.microsoft.com/en-us/data/aa937695.aspx
(http://msdn2.microsoft.com/en-us/data/aa937695.aspx)
Please visit the Microsoft Universal Data Access Web site for more information:
http://msdn.microsoft.com/en-us/data/aa937729.aspx
(http://www.microsoft.com/data)
The code in the following Microsoft Knowledge Base article was taken
from the RDSVB sample, which demonstrates using RDS within Visual Basic:
183609
(http://support.microsoft.com/kb/183609/EN-US/
)
FILE: Rdsvb.exe Demonstrates How to Use RDS with Visual Basic
| Article Translations
|
Back to the top
