Nota
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Se aplica a: Access 2013 | Access 2016
En el siguiente código se muestra cómo establecer el parámetro RDS.DataControl durante el diseño y cómo enlazarlo a un control para datos mediante el proveedor SQLOLEDB. Corte y pegue este código en un documento ASP normal y denomínelo ServerDesignVBS.asp. El script de ASP identificará al servidor.
<!-- BeginServerDesignVBS --><%@ Language=VBScript %>
<html><head>
<meta name="VI60_DefaultClientScript" content=VBScript><meta name="GENERATOR" content="Microsoft Visual Studio 6.0">
<title>Server Property Example (VBScript)</title><style>
<!--body {
font-family: 'Verdana','Arial','Helvetica',sans-serif;BACKGROUND-COLOR:white;
COLOR:black;}
.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;}
--></style>
</head>
<body><h1>Server Property Example (VBScript)</h1>
<TABLE DATASRC=#RDS><TR>
<TD> <SPAN DATAFLD="FirstName"></SPAN> </TD><TD> <SPAN DATAFLD="LastName"></SPAN> </TD>
<TD> <SPAN DATAFLD="Title"></SPAN> </TD><TD> <SPAN DATAFLD="Type"></SPAN> </TD>
<TD> <SPAN DATAFLD="Email"></SPAN> </TD></TR>
</TABLE><!-- Remote Data Service with Parameters set at Design Time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"ID=RDS HEIGHT=1 WIDTH=1>
<PARAM NAME="SQL" VALUE="Select * from Employees"><PARAM NAME="SERVER" VALUE="https://<%=Request.ServerVariables("SERVER_NAME")%>">
<PARAM NAME="CONNECT" VALUE="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'"></OBJECT>
</body></html>
<!-- EndServerDesignVBS -->
En el siguiente ejemplo se muestra cómo establecer los parámetros necesarios de RDS.DataControl en tiempo de ejecución. Para probar este ejemplo, corte y pegue este código en un documento ASP normal y denomínelo ServerRuntimeVBS.asp. El script de ASP identificará al servidor.
<!-- BeginServerRuntimeVBS --><%@ Language=VBScript %>
<html><head>
<meta name="VI60_DefaultClientScript" content=VBScript><meta name="GENERATOR" content="Microsoft Visual Studio 6.0">
<title>Server Property Example (VBScript)</title><style>
<!--body {
font-family: 'Verdana','Arial','Helvetica',sans-serif;BACKGROUND-COLOR:white;
COLOR:black;}
.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;}
--></style>
</head>
<body><h1>Server Property Example (VBScript)</h1>
<H2>RDS API Code Examples</H2>
<H3>Remote Data Service Server Property Set at Run Time</H3>
<!-- RDS.DataControl with no parameters set at design time --><OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=RDC HEIGHT=1 WIDTH=1></OBJECT>
<TABLE DATASRC=#RDC><TR>
<TD> <SPAN DATAFLD="FirstName"></SPAN> </TD><TD> <SPAN DATAFLD="LastName"></SPAN> </TD>
<TD> <SPAN DATAFLD="Title"></SPAN> </TD><TD> <SPAN DATAFLD="Type"></SPAN> </TD>
<TD> <SPAN DATAFLD="Email"></SPAN> </TD></TR>
</TABLE>
<HR><Input Size=70 Name="txtServer" Value="https://<%= Request.ServerVariables("SERVER_NAME")%>">
<BR><Input Size=70 Name="txtConnect" Value="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'">
<BR><Input Size=70 Name="txtSQL" Value="Select * from Employees">
<HR><INPUT TYPE=BUTTON NAME="Run" VALUE="Run"><BR>
<Script Language="VBScript"><!--
' Set parameters of RDS.DataControl at Run TimeSub Run_OnClick
RDC.Server = txtServer.ValueRDC.SQL = txtSQL.Value
RDC.Connect = txtConnect.ValueRDC.Refresh
End Sub-->
</Script>
</body></html>
<!-- EndServerRuntimeVBS -->
Consulte también
- Objeto DataControl (RDS) - Propiedad Server (RDS)
- Acceso al foro de desarrolladores
- Acceso a la ayuda en support.office.com
- Acceso a la ayuda en answers.microsoft.com
- Acceso a foros en UtterAccess
- Acceso al centro de ayuda de programadores VBA y desarrolladores (FMS)
- Acceso a las publicaciones en StackOverflow
Soporte técnico y comentarios
¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.