Refresh 메서드 예제(VBScript)
중요하다
Windows 8 및 Windows Server 2012부터 RDS 서버 구성 요소는 더 이상 Windows 운영 체제에 포함되지 않습니다(자세한 내용은 Windows 8 및 Windows Server 2012 호환성 쿡북 참조). RDS 클라이언트 구성 요소는 이후 버전의 Windows에서 제거됩니다. 새 개발 작업에서 이 기능을 사용하지 말고 현재 이 기능을 사용하는 애플리케이션을 수정할 계획입니다. RDS를 사용하는 애플리케이션은 WCF Data Service마이그레이션해야 합니다.
다음 예제에서는 RDS의 필요한 매개 변수를 설정하는 방법을 보여 줍니다. DataControl은 런타임에. Refresh 메서드를 사용하여 Recordset 검색하는 방식은 ExecuteOptions 설정 및 FetchOptions 속성을 따라 결정됩니다. 이 예제를 테스트하려면 다음 코드를 잘라내어 일반 ASP 문서에 붙여넣고 이름을 RefreshVBS.asp. 찾기 사용하여 Adovbs.inc 파일을 찾아 사용하려는 디렉터리에 배치합니다. ASP 스크립트는 서버를 식별합니다.
<!-- BeginRefreshVBS -->
<%@ Language=VBScript %>
<!--use the following META tag instead of adovbs.inc-->
<!--METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->
<html>
<head>
<meta name="VI60_DefaultClientScript" content=VBScript>
<meta name="GENERATOR" content="Microsoft Visual Studio 6.0">
<title>Refresh Method 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>Refresh Method Example (VBScript)</h1>
<H2>RDS API Code Examples </H2>
<HR>
<TABLE DATASRC=#RDC>
<TR>
<TD> <INPUT DATAFLD="FirstName" SIZE=15> </TD>
<TD> <INPUT DATAFLD="LastName" SIZE=15> </TD>
<TD> <INPUT DATAFLD="Title" SIZE=15> </TD>
<TD> <INPUT DATAFLD="HireDate" SIZE=15> </TD>
</TR>
</TABLE>
<!-- RDS.DataControl with no parameters set at design time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=RDC HEIGHT=1 WIDTH=1>
</OBJECT>
<HR>
Server: <Input Size=70 Name="txtServer" Value="https://<%=Request.ServerVariables("SERVER_NAME")%>"><BR>
Connect: <Input Size=70 Name="txtConnect" Value="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'"><BR>
SQL: <Input Size=70 Name="txtSQL" Value="Select * from Employees">
<HR>
<TABLE BORDER=1 WIDTH="60%">
<TR>
<TD COLSPAN=3 BGCOLOR=silver>
Choose if you want the Recordset brought back Synchronously on the
current calling thread or Asynchronously on another thread.
</TD>
</TR>
<TR>
<TD>Synchronously: <BR>
<Input Type="Radio" Name="optExecuteOptions" Checked OnClick="SetExO('adcExecSync')">
</TD>
<TD>Asynchronously: <BR>
<Input Type="Radio" Name="optExecuteOptions" OnClick="SetExO('adcExecAsync')">
</TD>
<TD> </TD>
</TR>
<TR>
<TD COLSPAN=3 BGCOLOR=silver>
Fetch Up Front, Background Fetch with Blocking or Background Fetch
without Blocking
</TD>
<TR>
<TD>Up Front:<BR>
<Input Type="Radio" Name="optFetchOptions" OnClick="SetFO('adcFetchUpFront')">
</TD>
<TD>Background w/ Blocking:<BR>
<Input Type="Radio" Name="optFetchOptions" Checked OnClick="SetFO('adcFetchBackground')">
</TD>
<TD>Background w/o Blocking:<BR>
<Input Type="Radio" Name="optFetchOptions" OnClick="SetFO('adcFetchAsync')">
</TD>
</TR>
</TABLE>
<INPUT TYPE=BUTTON NAME="Run" VALUE="Run"><BR>
<Script Language="VBScript">
<!--
Dim EO 'ExecuteOptions
Dim FO 'FetchOptions
EO = "adcExecSync" 'Default value
FO = "adcFetchBackground" 'Default value
Sub SetExO(NewEO)
EO = NewEO
End Sub
Sub SetFO(NewFO)
FO = NewFO
End Sub
' Set parameters of RDS.DataControl at Run Time
Sub Run_OnClick
RDC.Server = txtServer.Value
RDC.SQL = txtSQL.Value
RDC.Connect = txtConnect.Value
If EO = "adcExecSync" Then 'Determine which ExecuteOption chosen
RDC.ExecuteOptions = adcExecSync
MsgBox "Recordset brought in on current calling thread Synchronously"
Else
RDC.ExecuteOptions = adcExecAsync
MsgBox "Recordset brought in on another thread Asynchronously"
End If
If FO = "adcFetchBackground" Then 'Determine which FetchOption chosen
RDC.FetchOptions = adcFetchBackground
MsgBox "Control goes back to user after first batch of records returned"
ElseIf FO = " adcFetchUpFront" Then
RDC.FetchOptions = adcFetchUpFront
MsgBox "All records returned before control goes back to user"
Else
RDC.FetchOptions = adcFetchAsync
MsgBox "Control goes back to user immediately"
End If
RDC.Refresh
End Sub
-->
</Script>
</body>
</html>
<!-- EndRefreshVBS -->
참고 항목
DATAControl 개체(RDS)
RDS(ExecuteOptions 속성)
FETCHOptions 속성(RDS)
ADO(Recordset 개체)
ADO(Refresh 메서드)