'BeginConvertToStringVB 'To integrate this code 'replace the data source and initial catalog values 'in the connection string Public Sub ConvertToStringX() ' to integrate this code replace the server name ' in the CreateObject call ' RDS variables Dim rdsDS As RDS.DataSpace Dim rdsDC As RDS.DataControl Dim rdsDF As Object ' recordset and connection variables Dim rsAuthors As ADODB.Recordset Dim strSQLAuthors As String Dim strCnxn As String Dim varString As Variant ' Create a DataSpace object Set rdsDS = New RDS.DataSpace ' Create a DataFactory object Set rdsDF = rdsDS.CreateObject("RDSServer.DataFactory", "http://MyServer") ' Get all of the Author records strCnxn = "Provider=sqloledb;Data Source=MyServer;Initial Catalog=pubs;User ID=sa;Password=;" strSQLAuthors = "SELECT * FROM Authors" Set rsAuthors = rdsDF.Query(strCnxn, strSQLAuthors) ' Show results Debug.Print "Old RDS recordset:" & rsAuthors.RecordCount ' Convert the recordset into a MIME formatted string varString = rdsDF.ConvertToString(rsAuthors) ' Convert string value back into an ADO Recordset Set rdsDC = New RDS.DataControl rdsDC.SQL = varString rdsDC.ExecuteOptions = adcExecSync rdsDC.FetchOptions = adcFetchUpFront rdsDC.Refresh ' Show results Debug.Print "New ADO recordset:" & rdsDC.Recordset.RecordCount ' clean up rsAuthors.Close Set rsAuthors = Nothing Set rdsDC = Nothing Set rdsDS = Nothing Set rdsDC = Nothing End Sub 'EndConvertToStringVB
ConvertToString Method (RDS) | Recordset Object
© 1998-2001 Microsoft Corporation. All rights reserved.