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 Name | Description |
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. |
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.
The DataFactory object's CreateRecordset method is identical to the CreateRecordset method of the DataControl object. For more information, see the section "CreateRecordset method."
The DataFactory object's Query method returns a Recordset object based on a query string. This method accepts three parameters:
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:
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.