URL Property Example (VBScript)


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 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.

The following code demonstrates how to set the URL property on the client side to specify an .asp file that in turn handles the submission of changes to the data source.

<!-- BeginURLClientVBS -->  
<%@ Language=VBScript %>  
    <meta name="VI60_DefaultClientScript"  content=VBScript>  
    <meta name="GENERATOR" content="Microsoft Visual Studio 6.0">  
    <title>URL Property Example (VBScript)</title>  
body {  
   font-family: 'Verdana','Arial','Helvetica',sans-serif;  
.thead {  
   background-color: #008080;   
   font-family: 'Verdana','Arial','Helvetica',sans-serif;   
   font-size: x-small;  
   color: white;  
.thead2 {  
   background-color: #800000;   
   font-family: 'Verdana','Arial','Helvetica',sans-serif;   
   font-size: x-small;  
   color: white;  
.tbody {   
   text-align: center;  
   background-color: #f7efde;  
   font-family: 'Verdana','Arial','Helvetica',sans-serif;   
   font-size: x-small;  

<body onload=Getdata()>  
<h1>URL Property Example (VBScript)</h1>  
<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=ADC width=1>  

<table datasrc="#ADC" align="center">  
<tr id="ColHeaders" class="thead2">  
<tbody class="tbody">  
   <td><input datafld="FirstName" size=15> </td>  
   <td><input datafld="LastName" size=25> </td>  
   <td><input datafld="Extension" size=15> </td>  

<script Language="VBScript">  
Sub Getdata()  

      ADC.URL = "http://MyServer/URLServerVBS.asp"  
End Sub  


<!-- EndURLClientVBS -->  

The server-side code that exists in URLServerVBS.asp submits the updated Recordset to the data source.

<!-- BeginURLServerVBS -->  
<%@ Language=VBScript %>  

        ' XML output req's  
    Response.ContentType = "text/xml"  
    const adPersistXML  = 1  

        ' recordset vars  
    Dim strSQL, rsEmployees   
    Dim strCnxn, Cnxn  

    strCnxn = "Provider='sqloledb';Data Source=" & _  
            Request.ServerVariables("SERVER_NAME") & ";" & _  
            "Integrated Security='SSPI';Initial Catalog='Northwind';"  
    Set Cnxn = Server.CreateObject("ADODB.Connection")  
    Set rsEmployees = Server.CreateObject("ADODB.Recordset")  

    strSQL = "SELECT FirstName, LastName, Extension FROM Employees"  

    Cnxn.Open strCnxn  
    rsEmployees.Open strSQL, Cnxn  

        ' output as XML  
    rsEmployees.Save Response, adPersistXML  

        ' Clean up  
    Set rsEmployees = Nothing  
    Set Cnxn = Nothing  
<!-- EndURLServerVBS -->  

See Also

URL Property (RDS)