--- $title: "DataSpace Object and CreateObject Method Example (VBScript) | Microsoft Docs" ms.prod: "sql-non-specified" ms.custom: "" ms.date: "01/19/2017" ms.reviewer: "" ms.suite: "" ms.tgt_pltfrm: "" ms.topic: "article" dev_langs: - "VB" helpviewer_keywords: - "DataSpace object [RDS], VBScript example" - "CreateObject method [ADO], VBScript example" ms.assetid: 12b0e160-5e5c-441f-bed7-ac0bd061e003 caps.latest.revision: 16 author: "MightyPen" ms.author: "annemill" manager: "sonalm" --- # DataSpace Object and CreateObject Method Example (VBScript) > [!IMPORTANT] > Beginning with Windows 8 and Windows Server 2012, RDS server components are no longer included in the Windows operating system (see Windows 8 and [Windows Server 2012 Compatibility Cookbook](https://www.microsoft.com/en-us/download/details.aspx?id=27416) for more detail). RDS client components will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Applications that use RDS should migrate to [WCF Data Service](http://go.microsoft.com/fwlink/?LinkId=199565). The following example shows how to use the [CreateObject](../../../ado/reference/rds-api/createobject-method-rds.md) method of the [RDS.DataSpace](../../../ado/reference/rds-api/dataspace-object-rds.md) with the default business object, [RDSServer.DataFactory](../../../ado/reference/rds-api/datafactory-object-rdsserver.md). To test this example, cut and paste this code between the \ and \ tags in a normal HTML document and name it **DataSpaceVBS.asp**. ASP script will identify your server. ``` DataSpace Object and CreateObject Method Example (VBScript)

DataSpace Object and CreateObject Method Example (VBScript)

RDS API Code Examples


Using Query Method of RDSServer.DataFactory


Click Run - The CreateObject Method of the RDS.DataSpace Object Creates an instance of the RDSServer.DataFactory. The Query Method of the RDSServer.DataFactory is used to bring back a Recordset.

``` The following example shows how to use the **CreateObject** method to create an instance of a custom business object, VbBusObj.VbBusObjCls. It also uses the Active Server Pages scripting to identify the Web server name. To see the complete example, open the sample applications selector. In the **Client Tier** column, select **VBScript in Internet Explorer**. In the **Middle Tier** column, select **Custom Visual Basic Business Object**. > [!NOTE] > If you are connecting to a data source provider that supports Windows authentication, you should specify **Trusted_Connection=yes** or **Integrated Security = SSPI** instead of user ID and password information in the connection string. ``` Sub Window_OnLoad() strServer = "http://<%=Request.ServerVariables("SERVER_NAME")%>" Set BO = ADS1.CreateObject("VbBusObj.VbBusObjCls", strServer) txtConnect.Value = "dsn=Pubs;uid=MyUserID;pwd=MyPassword;" txtGetRecordset.Value = "Select * From authors for Browse" End Sub ``` ## See Also [CreateObject Method (RDS)](../../../ado/reference/rds-api/createobject-method-rds.md) [DataSpace Object (RDS)](../../../ado/reference/rds-api/dataspace-object-rds.md)