VariableDispenser.Reset Method
Clears both the read-only list and read/write list when the call to GetVariables fails.
네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
구문
‘선언
Public Sub Reset
public void Reset ()
public:
void Reset ()
public void Reset ()
public function Reset ()
주의
업데이트된 예제 코드:2006년 7월 17일
This method can be used to clear the read-only list and the read/write lock list after a call to GetVariables has failed. If a call to GetVariables fails, the lock lists are not cleared and therefore, if you call GetVariables again, an attempt will be made to lock the same variables. If you want to retry locking the same variables, call GetVariables again without calling Reset first. Or, you can choose to release the lists by using this method and abandoning the operation until all required variables are available and can be locked at once.
Additionally, the Reset method is used if you receive a failure from GetVariables and you want to lock a completely different and unrelated set of variables next. You would call Reset to clear the lock lists, and then refill the lock lists by using the LockForRead, LockForWrite, LockOneForRead, and LockOneForWrite methods.
예
The following code example locks a collection of variables, and then determines whether the variable collection is locked before unlocking them. If the lock failed, then Reset is called.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace Microsoft.SqlServer.SSIS.Sample
{
class Program
{
static void Main(string[] args)
{
Package pkg = new Package();
Variables vars = null;
VariableDispenser variableDispenser = pkg.VariableDispenser;
variableDispenser.LockForRead("System::PackageName");
variableDispenser.LockForRead("System::OfflineMode");
variableDispenser.GetVariables(ref vars);
// Determine whether the variable collection is locked.
Boolean isLocked = vars.Locked;
// Verify the value of vars.Locked. If the lock failed,
// call Reset.
if (isLocked)
{
vars.Unlock();
}
else
{
variableDispenser.Reset();
}
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace Microsoft.SqlServer.SSIS.Sample
Class Program
Shared Sub Main(ByVal args() As String)
Dim pkg As Package = New Package()
Dim vars As Variables = Nothing
Dim variableDispenser As VariableDispenser = pkg.VariableDispenser
variableDispenser.LockForRead("System::PackageName")
variableDispenser.LockForRead("System::OfflineMode")
variableDispenser.GetVariables( vars)
' Determine whether the variable collection is locked.
Dim isLocked As Boolean = vars.Locked
' Verify the value of vars.Locked. If the lock failed,
' call Reset.
If isLocked = True Then
vars.Unlock()
Else
variableDispenser.Reset()
End If
End Sub
End Class
End Namespace
스레드 보안
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
VariableDispenser Class
VariableDispenser Members
Microsoft.SqlServer.Dts.Runtime Namespace