LogProviderBase.OpenLog Yöntemi
Dış veri kaynaklarına bağlantıları kurmak için paket yürütme başında denir.
Ad Alanı: Microsoft.SqlServer.Dts.Runtime
Derleme: Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS içinde.dll)
Sözdizimi
'Bildirim
Public Overridable Sub OpenLog
'Kullanım
Dim instance As LogProviderBase
instance.OpenLog()
public virtual void OpenLog()
public:
virtual void OpenLog()
abstract OpenLog : unit -> unit
override OpenLog : unit -> unit
public function OpenLog()
Açıklamalar
paket yürütme ve öncesinde gerçekleşen herhangi bir yürütme olayların başında bu yöntem çağrılır.Dış veri kaynaklarına bağlantıları kurmak ve çağrıları yanıtlamak üzere hazırlamak için bu yöntem kullanmanız Log yöntem.
Örnekler
Aşağıdaki örnek, bir harici metin dosyası kullanarak bağlamayı gösterir ConnectionManager içinde belirtilen ConfigString özellik.Bağlantı değişkeni önbelleğe
InitializeLogProvideryöntem.
public override void OpenLog()
{
// Get the ConnectionManager from the package's
// Connections collection.
connectionManager cm = connections[ConfigString];
// AcquireConnection for a file ConnectionManager
// retrieves the path to the file.
string path = (string)cm.AcquireConnection(null);
// Instantiate the stream writer, and writes the opening
// log entry.
this.sw = new StreamWriter(path);
sw.WriteLine("OpenLog: " + DateTime.Now.ToShortDateString());
}
Public Overrides Sub OpenLog()
' Get the ConnectionManager from the package's
' Connections collection.
Dim cm As connectionManager = connections(ConfigString)
' AcquireConnection for a file ConnectionManager
' retrieves the path to the file.
Dim path As String = CType(cm.AcquireConnection(Nothing), String)
' Instantiate the stream writer, and writes the opening
' log entry.
Me.sw = New StreamWriter(path)
sw.WriteLine("OpenLog: " + DateTime.Now.ToShortDateString())
End Sub