RDSServer DataFactory Object

[Previous] [Next]

The DataFactory object is an RDS component that runs on your IIS server. In fact, the DataControl object passes the connection and query strings to the DataFactory component on the server that you've specified.

NOTE
I've found that if you use the DataSpace object in Visual Basic, you should dimension your business object variable as Object rather than use early binding.

You can use the DataFactory object to query and update your database. You can also convert Recordsets to MIME strings and generate empty Recordsets.

Think of the DataFactory object as a generic business object designed to help you communicate with your database through queries. DataFactory acts as the default server-side object of RDS. When you use the DataControl object to query your database, RDS instantiates a hidden DataFactory object on your server to submit the query. Let's take a closer look at the methods available through the DataFactory object, shown in the following table.

Methods of the RDSServer DataFactory Object
Method NameDescription
ConvertToString Converts the Recordset to a MIME-encoded string.
CreateRecordset Creates a new, empty Recordset with the structure you request.
Execute Interacts with the RDS DataControl. Not intended for external use.
Query Connects to your database, executes a query, and retrieves the results.
SubmitChanges Submits the changes in the specified Recordset to the database associated with a connection string.
Synchronize Interacts with the RDS DataControl. Not intended for external use.

ConvertToString Method

The ConvertToString method accepts a Recordset object and returns its contents in a MIME-encoded string. This method is designed for ASP programmers who want to embed the contents of a Recordset in an HTML page.

The ConvertToString method is already somewhat antiquated. There are better ways to send data to your client application. Rather than using MIME-encoded strings, you might want to consider marshaling the object itself through a business object, using the DataSpace object or the Execute or Query method on the DataFactory object. Another option is to store the contents of a Recordset in XML format using the ASP Response object and to use the DataControl object's URL property to retrieve the contents.

CreateRecordset Method

The DataFactory object's CreateRecordset method is identical to the CreateRecordset method of the DataControl object. For more information, see the section "CreateRecordset method."

Query Method

The DataFactory object's Query method returns a Recordset object based on a query string. This method accepts three parameters:

  • bstrConnection This required parameter is the connection string that the DataFactory will use to communicate with your database.
  • bstrQuery You specify the query string you want to submit to your database in this required parameter.
  • IMarshalOptions This optional parameter accepts a long value from ADCFetchOptionEnum. For information on these values, see the section "FetchOptions property."

SubmitChanges Method

The DataFactory object's SubmitChanges method is similar to the SubmitChanges method of the DataControl object. The SubmitChanges method on the DataFactory object accepts two required parameters:

  • bstrConnection Supply the connection string for your database in this parameter.
  • pRecordset Supply the Recordset object that has pending changes you want to submit to the database in this parameter.

One difference between this method and its DataControl namesake is that with the DataFactory object's SubmitChanges method, pending changes in records that aren't visible because of the filter applied to the Recordset are still submitted to your database. The DataFactory object still wraps these changes in a transaction so that if any of the pending changes fail, the entire batch of changes fails.



Programming ADO
Programming MicrosoftВ® ADO.NET 2.0 Core Reference
ISBN: B002ECEFQM
EAN: N/A
Year: 2000
Pages: 131
Authors: David Sceppa

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net